- Home /
iphone: how to tap and make an object delete?
I just want to be able to tap an object and have it delete.
When it deletes I want it to add to a variable.
If the variable equals a certain number then load next level or reload the current level.
Answer by qJake · May 21, 2010 at 04:40 AM
I'm not going to write the script for you, but I will explain what you have to use.
When someone touches the screen, cast a ray from the position on the screen outward. Check if you hit a ball. If you did, call Destroy(...)
with the hit object's game object as a parameter. In the same script, have a global variable defined called "Count" or something like that, and inside of Update()
, check if "Count" is greater than a number, if it is, call Application.LoadLevel(...)
with the next scene as your parameter.
Your answer
![](https://koobas.hobune.stream/wayback/20220613012601im_/https://answers.unity.com/themes/thub/images/avi.jpg)