How create node using cocostudio at cocos2d-x v3.2?

Hi all.
I am developing cocos2d-x 3.2.
I tried to create node using cocostudio in cocos2d-x 3.2.
But I got retain error.
I don’t know reason.
I’d like to know about that.

Thanks.

Can you show us what you are doing?

I tried to create scene using json or csb file.
But I got issue such as image file.
Scene file is construct a image file.

Thanks.

What is the value of your pGameScene pointer? Is it a nullptr?

As your image cannot be found(see the log), there is nothing to add and it will not be retained.
Make sure your path is correct.

as first Image, I think you should use publish/FirstScene.json as path.

I found issue.
Problem is josn file.
That is,
“components”: [
{
“__type”: “ComSpriteSurrogate:#EditorCommon.JsonModel.Component”,
“classname”: “CCSprite”,
“name”: “CCSprite”,
“file”: null,
“fileData”: {
“path”: “img/bg.png”,
“plistFile”: “”,
“resourceType”: 0
}
}
]

I replace “img/bg.png” to “bg.png”.
So I created scene.

I’d like to know how use cocostudio version for cocos2d-x v3.2.

Thanks.

You have to add “img” to your asset search path, so the engine can find it.

Can I find where asset search path?

With getSearchPaths()

http://www.cocos2d-x.org/reference/native-cpp/V3.4/dc/d69/classcocos2d_1_1_file_utils.html#ac775251aed9a31fd8bc9b6f3abd9959e

Thanks for reply.
And I have any question.
I tried to import UI project to Scene project.
I couldn’t set json File Path in UI Component.
Can you help me?

What do you mean by that?

Which CS are you using? 1.x or 2.x?

You can only import resources in CS. The json path for the exported/published assets is the folder/file layout you see in the Resources panel of CS.

I imported UI.
Could you teach away to add “img”?
That is, using getSearchPaths() in my code.

Thanks.

You add img to the search path with:

FileUtils::getInstance()->addSearchPaths("img");

You can then print out the search paths with this code:

std::vector<std::string> paths = FileUtils::getInstance()->getSearchPaths();
for(std::vector<std::string>::const_iterator it = paths.cbegin(); it != paths.cend(); ++it)
    log("search-path: %s", (*it).c_str());

If then, such as image file, many folder exist in “Resources” folder, is it need to add all folder?

You only need to add the folders directly under Resources, E.g. fonts and publish. The sub-folders inside those folders are auto-searched.

Thanks.

And can I integrate cocostudio v2.1 and cocos2d-x v3.2?
If it’s possible, could you teach it?

Hi @Bailang take a look at this thread: Cocos Studio 2 Feedback