dongju.jeong Posted October 18, 2018 Posted October 18, 2018 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?
morbid Posted October 18, 2018 Posted October 18, 2018 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
dongju.jeong Posted October 19, 2018 Author Posted October 19, 2018 (edited) I 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 October 19, 2018 by dongju.jeong
fox Posted October 19, 2018 Posted October 19, 2018 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: Accessing Nodes and Files via Properties NodeReference Class article Hope this helps! Thank you!
Recommended Posts