I am using Cocos2d-x engine with 3.2 version.
In my splash screen I am prefeching a plist by below line
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui.plist");
Now inside game when I am creating a sprite I am getting an assert fail error
Sprite *ss = Sprite::createWithSpriteFrameName("pause.png");
Assert failed: Invalid spriteFrameName: pause.png
Also when the splash screen is removed, I am getting the below line in console
cocos2d: TextureCache: removing unused texture: D:/cocos2dx/projects/ABCD/Resources/mid/ui.png
Is there anything I need to add or something?
I was doing the same thing for 2.x and was working but not in 3.2
EDIT:
In 3.x if you are calling this line
Director::getInstance()->purgeCachedData();
, remember that it will delete all textures from the cache memory. So handle all sprite-sheets manually.
addSpriteFramesWithFile()
in new scenes as solution. I hope some one from cocos2d team answer the reason of this strange unloading. \$\endgroup\$