- Home /
How do I apply all things to all clone game objects.
I have grouped them all under an empty game object and I want to make it that each of the objects spawned have a Y position of one. So basically I want each one spawned to always have a y of 1. Also I have made obstacles in my infinite runner and I want It so that once you have touched them you die? Last one I want them all to translate backwards. Any ideas? Thx for the help in advance.
Answer by tormentoarmagedoom · Sep 12, 2017 at 04:57 PM
Goo day @TheChanger.
First, dont create 2 Questions for the same matter. Please delete this other question.
Now, let's see...
You want to Instantiate a list of GameObjects at a determinate position. Is simple, when using instantiate, you have to determine the position og the gameobject with a Vector3 (x,y,z) variable. So just:
Instantiate(Object, new Vector3(TheXyouwant,1,TheZyouwant),new Quaternion (0,0,0,0);
But if you have the object created and want to move them all, you need to make an array or a List with all the elements and then use the foreach loop.
If you want to detect when your runner touches a GameObject, you need to use the OnTriggerEnter method. You can see how to use it in the answer of this other post.
And i dont understand what you mean with
"Last one I want them all to translate backwards"
Please upvote if helped, and ask for more if need more help using @tormentoarmagedoom
And remember to delete this other question !