I lack a basic understanding of Unity3D programming. Here is what I do:
The project is a simulation of maritime ECDIS (the same as your car’s GPS but for ships) I made several ship game objects, each with their own rigid bodies but all having a common script describing the ship’ properties and model. The Inspector then shows and can change the individual speed, course, waypoints, etc.
It works fine … Until I notice that some elements are not correct. For example the ship game object has a child object that shows the speed of each vessel as a vector line. While the parent object follows the script that is attached to, the child objects all show a vector coming from only one parent object, the speed.
Now, I access this child object using Find and GetComponent, but it doesn’t work and I am pretty sure that I mess up everything.
My question is basically this: when you attach the same script to several object, are they duplicated/instantiated? How do you make several child object with the same name, to follow a single script with different variables set in the Inspector?
The reason I work this way is that I’ll have to make several exercises, each with a different configuration of ships and I don’t want to have to access individual scripts in the process, only change the parameters in the Inspector.
Thanks in advance.
Cheers,
Michel