Expected Result: PowerUp GameObject floats around the screen and bounces off collision (e.g. walls) until it collides with a player, or gets destroyed by their bullets. Bullets should only do 1 point of damage per collision.
Setup: I have a PowerUp GameObject that has both a CircleCollider2D with a Bounce Material to get it to bounce off collision, and a BoxCollider2D flagged as “isTrigger” to get it to apply the PowerUp effect to the player that collides with it.
Actual Results: PowerUp GameObject works except for that it sometimes takes double damage per shot. I assume based on research that this is due to the fact I have two colliders on the same GameObject.
Request: How can I set this GameObject up to achieve the Expected Result?
Here’s a code snippet that handles the damage. Basic stuff:
if (collision.CompareTag ("Laser_p1") || collision.CompareTag("Laser_p2"))
{
health--;
Destroy(collision.gameObject);
FindObjectOfType<AudioManager>().Play("powerup_hit");
StartCoroutine(Flash());
}