Dynamicly creating scenes

hi
how do i dynamicaly create a scene in cocos creator project?
i want to generate scenes by code without creating them first in the IDE, is this possible?
i tried doing

    var scene = new cc.Scene();
    scene.name = "scene1"
    cc.director.loadScene("scene1")

but i get an error loadScene: Can not load the scene 'matan' because it was not in the build settings before playing.

Hi , I think you should use prefab instead of scene.
You can have many prefabs and create them dynamically and insert them to your scene.

2 Likes

But I wish the node to behave like a scene, meaning the director can use it to change scenes. This is possible with the regular cocos2dx engine , there cc.director has a “runScene” method that takes a scene object .
In cocos creator on the other hand that api got removed