Jump to content

[SOLVED] Adding a new root node into a world using UnigineScript


photo

Recommended Posts

Hello,

Sorry for asking so many questions about UnigineScript lately. I know it's deprecated and not recommended but I'm porting old UnigineScript so there is no other work around for now.

The following UnigineScript code was used in Unigine 2.6.1 which creates a new root node into the currently loaded world :

Node g_not_saved = 0;

string NOT_SAVED_NODE = "not_saved";

Node getNotSavedNode()
{
    if(g_not_saved == 0)
    {
        g_not_saved = new NodeDummy();
        g_not_saved.setName(NOT_SAVED_NODE);
        {
            // Setting this to 1 stops the node from being saved.
            int IS_RUNTIME_NODE = 1;
            engine.editor.addNode(node_remove(g_not_saved), IS_RUNTIME_NODE);
        }
    }
    return g_not_saved;
}

In an attempt to migrate this into 2.15, and according to this page, here is how the script was ported :

Node g_not_saved = 0;

string NOT_SAVED_NODE = "not_saved";

Node getNotSavedNode()
{
    if(g_not_saved == 0)
    {
        g_not_saved = new NodeDummy();
        g_not_saved.setName(NOT_SAVED_NODE);
        
        node_remove(g_not_saved); //Is this even necessary?
    }
    return g_not_saved;
}

Now the new NodeDummy seems to be added into the world but is not in its hierarchy as a root node.

Any one knows why?

Thanks in advance

Link to comment
  • silent changed the title to [SOLVED] Adding a new root node into a world using UnigineScript
×
×
  • Create New...