how do i make a platform dissapear, as soon as the player touches it?
what i mean is ,, that you need to be able to stay in the platform ,, on an undetermined time. and as soon as you leave the platform it gets destroyed ,,,,,
i dont want the player just to collide with the platform and destroy it,, i want the player ,, as i said before beeing able to touch it and then as soon as you leave it ,,, it gets destroyed,,, peace ,
Answer by EDevJogos · Aug 18, 2016 at 02:29 PM
Make your platfrom a trigger, i suppose the game is 2D so i'm using Trigger2D, and put a .cs with this on it.
void OnTriggerExit2D(Collider2D other)
{
//If other objects can come in contact with the platfrom
//you'll have to check if the object thats exiting is the player.
//if it is destroy the platfrom
Destroy(gameObject);
}
Your answer
Follow this Question
Related Questions
How do you a attach script + event function to another script during runtime in unity? 0 Answers
Displaying Text on Touch Event 0 Answers
Jump Script Doesn't Affect my Player 0 Answers
Why is my script not working? 1 Answer
How do I ignore input when player object has reached a certain point? 1 Answer