Sprite::create("filename.png"); returns NULL

Hi, I’m trying to replace a png file for another one that has some minor modifications (the designer told me that he changed the type of transparency or something like that).

Now I’m having a problem when trying to create a Sprite using that file.
The console doesn’t show any message but after using Sprite:create(“filename.png”); the pointer returns as NULL… that makes my game crash.

Do you have any ideas of what makes this behavior?

Also I have to tell you that before using the file name to create the sprite I checked if it exists using :
bool fileExists = cocos2d::FileUtils::getInstance()->isFileExist("filename.png");

fileExists is true so I assume that the file is in the application bundle.

Can you post your code and show the NULL, please

Filenames are case sensitive. Maybe you changed something or you move it into another folder?

1 Like

A good point…

1 Like