Hi! I have a base script that is being attached to a gameobject and supposedly bunch of child class of this base script which are also attached to different gameobjects. In the other script I`m using GetComponentInParent to get base class. Is there a way to identify and get a child class from gameobjects?
What is the most simple solution.
In the parent script where you need to use another gameobject script simply write
`public GameObject childGameObject;`
Then compile and in the scene view click on this parent game object
and slide your child game object into childGameObject field.
Then in the parent script will have reference to child game object.
In your start function you can get the child script - better to do it once at start then every time needed
childScriptName = childGameObject.GetComponent<MyChildScriptName>();
Now you have 2 references, one to your child game object and second one to your child script.