Question by
Ciceri · Apr 29, 2016 at 07:30 PM ·
destroycollision detectioncollider2draycastingclick objects
Detect and destroy a 2D collider if I click with mouse on it
I have a game and I must destroy a ball (2D sprite with 2D collider) that bounce if i click on it.... I have already tried some solutions find on the net but they doesn't work.
Comment
Answer by NitroGain · Apr 04, 2017 at 06:28 PM
Just use:
void OnMouseDown() {
destroy(NameOfYourGameobject)
}
Your answer
Follow this Question
Related Questions
Unity Collider2D is causing the game object to disappear upon collision? 1 Answer
When Time.timeScale go from 1 to 0 Unity destroy a gameobject 1 Answer
reset destroyed collider after game restart 1 Answer
any idea for match3 games 1 Answer
How to kill player (and or end game) when enemy hits the ground? JAVASCRIPT 1 Answer