Answer the question
In order to leave comments, you need to log in
How to get the component of a child object?
There is a hierarchy of objects, the script weighs the root object, how you can get an object component from it that is lower in the hierarchy, knowing the name of the desired object. For example, there is a root empty tank object with a script describing its actions, other objects are nested in it: tower, hull, etc. And objects are nested in the tower object: a cannon and a machine gun. How to get the machine gun's transforn without resorting to findobject ?
Answer the question
In order to leave comments, you need to log in
You can do this with the Transform.GetChild(index) function
https://docs.unity3d.com/ScriptReference/Transform...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question