In Unity, how do I make objects restart a player upon contact?
I' m making a platformer/runner game in Unity. The player has to run down a thin platform, not falling off and dodging the obstacles. I'd like to make it where when the player touches the obstacles in resets the player to the starting point of that level. Is this done via script? If so would I have to script every object? And what would that script be, if that were the case?
Look through the unity tutorials for OnTrigger tutorials and Collider tutorials, they show what you can do when your object collides with something.
Answer by Verusoft · Jan 25, 2016 at 01:56 PM
Add 2D or 3D colliders (depends on type of your game) to obstacles and to player.
Add Rigidbodies to objects that are not static.
Add script to player and use OnCollisionEnter/OnTriggerEnter methods to check if player hits to an obstacle.
More info: http://docs.unity3d.com/Manual/PhysicsSection.html
Video tutorial: https://unity3d.com/learn/tutorials/modules/beginner/physics/colliders?playlist=17120
Your answer
Follow this Question
Related Questions
Simple Question 2 Answers
Load Scene Unity by Application.LoadLevelAsync 0 Answers
How to call functions from another script c# (Unity5) 1 Answer
GameJolt API simple Score 0 Answers
If statement noop :) 1 Answer