Jump to content

[SOLVED] create node by programming


photo

Recommended Posts

Posted

Unigine componentsystem can has a node type parameter in the property.

Like Unity, is there a way to take a prefab in a script as a GameObject variable(Node) and create an object in the scene with the Instantiate () function?

The point is that Unity uses a prefab. 

 

Is there a way to place an object in the scene with a function like instantiate () using something like Unity's prefab?

Posted

Could you please be more specific, what task you're trying to solve?

Do you want to clone a node with assigned property? Or you need to create a node in the world from code?

Thank you.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted (edited)

need to create a node in the world from code at runtime.

In the component system, I thought that I can create a node in the world with the code using the property node type parameter.

However, a node reference  can not assigned to the node type parameter.

 

If the unigine's node reference is equal to the unity's prefab, 

I want to assign object information such as node reference(prefab) to a  parameter instead of assigning a node that already exist in world.

and then,

I want create new node in the world using that parameter with code.

 

Edited by dongju.jeong
Posted

Hi dongju.jeong,

If I got you right, you have a nodereference in a *.node file, and want to assign it to a property parameter, to create a node at run time via code.

In this case, you can add a "file" parameter to your property with a link to your *.node file (containing you nodereference), and then create a nodereference node at run time via code like this:

NodeReferencePtr nodeRef = NodeReference::create(node_file);// node_file is to be taken from the corresponding property parameter

These two articles may be useful:

Hope this helps!

Thank you!

  • silent changed the title to [SOLVED] create node by programming
×
×
  • Create New...