triple shot prefab ...

triple shot prefab is adding score 3 times  



i have them all tag as laser and think thats the problem any ideas.

Topic Tags
3 Answers

Make sure to turn off the Enemy collider as soon as the Laser hits it before anything else. This should insure that only one laser is seeing the Enemy . 


if you have any ideas that be great i been looking around and cant find how to disable box collider 2d


Hi Thom,
I don't get the logic of turning off the Enemy Collider.
A collision with either the Player or a Laser results in the Enemy being transported in the same frame to the spawnZone (above the Viewport )
Turning off the collider would require turning it back on, which would make the code a little more convoluted.
It's possible I've strayed from the path somewhere and my functionality differs from the intended 🙂


any ideas what that code would look like and i found this gameObject.GetComponent(collider type).isTrigger = true;


i think i got it to work for shooting into the enemy multiple time would add score, but still having same issue with disabling box collider 2d

private BoxCollider2D boxcollider2d;

OnTriggerEnter2D method

boxcollider2d = gameObject.GetComponent<BoxCollider2D>() as BoxCollider2D;
boxcollider2d.size = new Vector2(.0f, .0f);
boxcollider2d.isTrigger = true; 

seem to work when i set the floats to 0f;

that what i found on unity3d website 

This post was modified 2 weeks ago 4 times by Dominick H


Should be something along the lines ".enabled".

At work, so cant check for sure.

hey no problem and thanks


if (other.tag == "Laser")
_isDead = true;
_enemySpeed = 0.5f;
_collider.enabled = false;
Destroy(this.gameObject, 3.5f);





Scroll to Top

Please Login or Register