Following the newly created object

At the beginning I would like to apologize for my weak English

What’s going on:

  • I’m making an Android app
  • I have a script “levelGenartor”, it’s obvious what is doing
  • Each of prefabs level has “childs”
  • The purple mark (empty Game.Object) is named and tagged as a “door”, and it’s generally a transition between levels
  • That’s how it looks like:


The player has to move right or left depending where is a door. When someone touch the screen the “player” jumps to the next level. At this point, the next transition (door) have to be found - based on their position the vector of the movement will change.

I am totally new in unity (about 2 weeks) and I think that I don’t have general knowledge about methods, functions etc. I tried many times with this but unfortunately with poor results. Any ideas ?

Moving camera infinitely is not a good idea, better to shift all floors down.
When a player jumps into the hole between 2 segments of the floor it can hit a trigger, add collider to your “purple mark object” and flag it as trigger. Then in your Player script you can use this:

void OnTriggerEnter(Collider other)
    Debug.Log(other.transform.position); // position of your trigger (floor transition market)
    LevelManager.TransitionToNextFloor(); // proceed to nex floor (your custom logic)

Make sure to add rigidbody to your player object

Is there any reason why the generated doors could not be a prefab that has a script object on it? The script would simply at instantiation find any game object you wish to find and assign it to the script. You then can do whatever you want with either object in that script. Find in unity can be found here: Unity - Scripting API: GameObject.Find