|
Hi! I have a game with a hero and enemies. The enemies are prefabs that, when hit by a bullet, drop boxes that I have do touch on to apply some heal to the hero's life. The logic problem is that when I have some boxes on the scene, I touch one of them the heal value should be 5, but what happens is that for some reason this runs for the number of boxes I have on the scene. For example: the scene has 4 boxes, and when I touch one of them the value applied is 20, or 4 * 5. It is finding all objects with the tag "pack" when I touch one of them... but why? What could be wrong? Here is my code:
using System.Collections; public class Package : MonoBehaviour {
}
(comments are locked)
|

I'd recommend adding some log messages to see what's going on. Print the positions of the colliders and boxes when you hit them. See how many touches are being processed.