Hello,
im trying to create a script to spawn GameObjects and want to move them then.
For this case i need to assign variables to the created objects.
Later i want to get the values of these variables to move the objects with the correct speed.
Normally i created a class, assigned variables to them, and could acess them by: " Object.variableName"
But i didnt figured out how that works in unity.
Her is an example of my code:
var myObject : GameObject = GameObject.FindGameObjectWithTag("inEditorCreatedSprite");
var spawnExampleObject : GameObject = Instantiate (myObject, spawnPosition, Quaternion.identity );
I want to givem them now “speed” and other variables, but i dont know how to assign / acess them to my created object.
Is "cloning"with instantinate even the correct method ? Outside of unity i created classes and children for these purposes…
Can somebody tell me how that works, or if there is an better way to do it?