Home | Documentation | Atomic Chat | Github

Issue with GetComponent


#1

I have a task to initialize Action variables from given path array. Array contains: name of the child node, class type name and method name. I can’t load class from GetComponent from Type (yes, tried MakeGenericType) and don’t understand how to work with StringHash (if there is API with explanation, I will be glad to receive a link).
Also I thought about using System.Reflection way, but don’t know where class Node contains info about its components.
P.S. Is there a way to get and then use a path to child Node? It will be usefull prevention of same name case malfunction.


#2

Is the component you’re trying to obtain’s class defined in C++ or in .Net? Node.GetComponent will only work on components defined in C++. For C# components you need to use Node.GetCSComponent (which is also only available from C#). This is because components defined in C# are actually instances of class CSComponent at the C++ level.