I’m trying to change a sprite image. I’ve done this before in my game and it works fine with the following method:
Now I’m trying the following code at another location but for some reason
SpriteFrameCache::getInstance()->getSpriteFrameByName("SpriteFrameName") returns nullptr, meaning it couldn’t find the
SpriteFrameName. On debug mode however I did manage to find the
SpriteFrameName as part of
Furthermore I was passing
SpriteFrameCache::getInstance() from my main game class to a custom object, even though
SpriteFrameCache is a singleton class so it should exist and be accessible anyway.
What am I missing here, how come I receive nullptr? Any advice would be more than welcome!