Jump to content

AddNode() question


photo

Recommended Posts

Posted

Usage Example/ Using Custom Component System

 

Why is there no addnode () function when creating a spinner node in AppWorldLogic ???

Is it automatically added when assigning a component to an object or assigning related properties?

image.png.e9ad4c2a6490577159368e2581d4438f.png

Posted

If you mean the addNode() method of the Editor class, it actually is used to pass node ownership to the Editor, which is not necessary here, as created nodes will be automatically owned by the Component System after adding a component, or assigning a property to them (see the comments inside the create_box() method in this example).

Thank you!

Posted

thank you!

then,

if I want to delete the object instead of the editor's removeNode, Is it correct to call the smart pointer's destroy () function?

Posted

You're welcome!

A node owned by the Component System can be destroyed using the destroyNode() method (receives a node pointer as an argument):

ComponentSystem::get()->destroyNode(some_node);

Thank you!

  • Like 1
×
×
  • Create New...