Binuraj Posted July 6, 2016 Posted July 6, 2016 Hi, What will be the default ownership of a Node created through a C# project, and how do I change ownership to Editor so that it appears in the Editor Node list? I'm aware of how to do the same through UnigineScript.
ded Posted July 8, 2016 Posted July 8, 2016 Hi Binuraj, It's a C# Node object will be an owner of a newly created node. You can release it from that ownership using release() method, or reclaim ownership back with grab() method. Use isOwner() method to check ownership flag. Here's an example of how you add MeshStatic to the Editor: public override int init() { // "mesh" is the owner ObjectMeshStatic mesh = new ObjectMeshStatic("samples/common/meshes/box.mesh"); // After release() a box still stays on the scene, but no one owns it mesh.release(); // Now Editor will be the owner of the node. // Editor will delete this node on world shutdown. (The world itself won't) Editor.get().addNode(mesh.getNode()); return 1; }
Recommended Posts