Two player collision ?

I have two players.
Each have rigid bodys (just saying)
i need a global script that detects their collision with eachother/when they collide with the other.

and sends them to the next level in the build.

its not just application.loadlevel (“nextlevel”)
that would take a bunch of different unique scripts which i dont need.

I need a way for the players to keep advancing to the next level everytime they collide with eachother. There are going to be multiple levels/scenes

ex: Player1 collides with Player2 loadlevel “level 2”
Player1 collides with player2 on level 2, “loadlevel 3”
so on and so forth.

any suggestions would help.

Thanks

For loading your levels you will have to make sure they are indexed correctly. You can use “Application.LoadLevel(Application.loadedLevel + 1);” which will load your next indexed level.

As for the collision, does it have to be a global script? I assume you are worried about the level loading being called twice. That should not be a problem, you can change the tag of the players to something other than “Player” when they have collided. That way when the other collision function runs, it won’t pass the tag check and the level load function will not be called again. When the level is loaded the players will be reset anyway right? If not you can always add the OnLevelWasLoaded function to the script and set the player tag back to “Player” manually.