I am working on building a basic space shooter game but am having trouble with a trigger collider.
In the game, I have a Bullet prefab that has a Capsule Trigger Collider attached to it and the enemy is right now a basic cube with a box collider attached to it.
When I run the game I start shooting the bullets and the Enemy cube doesn't disappear until after a few shots.
Here is my code for the bullet prefab:
void OnTriggerEnter(Collider col) {
if (col.tag == "Enemy") {
Destroy (col.gameObject);
}
}
And a screenshot of my Attributes of each game object:
Bullet Prefab:
And here is the enemy cube:
Here is a link to a video of what is happening...