Hi I am having trouble on a small project of mine.
I have a moving 2D level which moves from the right to the left. I want to spawn 1 out of two random objects at a spcific area of the level which is working. However when these objects spawn they a fix on the position where they spawned and are not moving with the level. So I guess I need to spawn these objects and then make them a child of the spawnpoint so the follow the spawnpoint. But how can I do that ?
My current code is:
var objs : GameObject ;
var SpawnPoint : Transform;
function Start () {
Instantiate(objs[(Random.Range(0, objs.Length))], SpawnPoint.position, Quaternion.identity);
}