Black image after close unity ads in android

Black image after close unity ads in android
0

#1

cocos2dx 3.17.1
sdkbox v1.0.2.8
android studio 3.3.1

i use unity ads for reward

step 1 - show unity ads

step 2 -click on close button when ads finished.

void MyClass::unityAdsDidFinish(const std::string& placementId, sdkbox::PluginUnityAds::SBUnityAdsFinishState state)

{
imageHint->setTexture(“btn_hint1_2.png”);
}
when texture changed then its showing black image instead of original image

in logcat this error log is continuously print

02-21 16:09:31.666 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.676 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.686 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.706 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: unityads state change rewardedVideo 3->0
02-21 16:09:31.706 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: unityads ready rewardedVideo
02-21 16:09:31.716 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.716 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.726 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.746 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.756 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.776 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.796 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.806 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.826 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.836 20351-20737/com.triangular.game.studio.words.world I/System: core_booster, getBoosterConfig = false
02-21 16:09:31.846 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.856 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.876 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in /Users/milanitaliya/MilanData/projects/projects3/WordsWorld/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 699
02-21 16:09:31.896 20351-20566/com.triangular.game.studio.words.world D/cocos2d-x debug info: OpenGL error 0x0502 in

please help me on this topic i think every one face this issue @yinjimmy

@shaktiraj are you face this issue ?


#2

I believe that the unityads callback is not from GLThread , plz try:

void MyClass::unityAdsDidFinish(const std::string& placementId, sdkbox::PluginUnityAds::SBUnityAdsFinishState state)

{
    cocos2d::Director::getInstance()->getScheduler()->performFunctionInCocosThread([imageHint]() {
        imageHint->setTexture("btn_hint1_2.png");
    });
}

#3

i try it but its not working


#4

is it possiable btn_hint1_2.png not exist or can’t be found?


#5

no its exist in resource i write same code in admob rewarded ads’s close method it is work fine not any issue only unity ads create this problem . and ones image set black then it’s display black even if i go next screen and back again in this screen


#6

@htlxyz can you help me on this topic ?


#7

is it the unity callback is not trigger in main thread.


#8

please solve this problem


#9

we try sample, but not reproduce, can you give us a sample project which can reproduce this issue.


#10

yes i will give you please give me email id


#11

would you plz share a GitHub repo.


#12

hugohuang1111@gmail.com


#13

please check mail i send you


#14

unity send finish event before cocos2d-x view resume.
you can change view like this:

void MyClass::unityAdsDidFinish ( const std::string & placementId ,
                                 sdkbox::PluginUnityAds::SBUnityAdsFinishState state )
{
    Sprite *i = this->image_2;
    this->scheduleOnce([i](float t) {
        i->setTexture("hintcount.png");
    }, 3, "t");
}

or modify sprite in node::update function


#15

this will take 3 sec time to change sprite


#16
  1. you change to 1 sec or shorter.
  2. another way, you can modify sprite in node::update function

#17

ok i will try this and inform you


#18

I have tried your sample, and make some modify:

void MyClass::unityAdsDidFinish ( const std::string & placementId ,
                                 sdkbox::PluginUnityAds::SBUnityAdsFinishState state )
{
    cocos2d::Director::getInstance()->getScheduler()->performFunctionInCocosThread([this]() {
        image_2->setTexture("hintcount.png");
    });
}

#19

this is better.