Jump to content

[SOLVED] Adding a new property to a library


photo

Recommended Posts

Hi,

 

I would like my program creates a new "my_library.prop" file. I've found this list of functions

 

https://developer.unigine.com/en/docs/1.0/code/scripting/library/engine/engine.properties

 

I successfully created an empty "my_library.prop" file using engine.properties.addWorldLibrary() function. My question is how can I add a new property to this library? Should I use "engine.properties.cloneProperty()" function? Then, which property should I use to clone? I've tried "node_base" but cloneProperty returns an error "PropertyManager::cloneProperty(): can't clone "node_base" parent property".

 

Thank you in advance for your help.

Link to comment

Base properties cannot be cloned or moved. you can only inherit properties from them.

 

engine.properties.addWorldLibrary("property_test/test.prop");
engine.properties.inheritProperty("node_base","property_test/test.prop","my_node_base");
engine.properties.save("property_test/test.prop");

Properties are usually created manually in XML file. If you need to create your properties strictly via scripts, you can open XML file, write data into it and save it.

  • Like 1
Link to comment
×
×
  • Create New...