Can any one help me with my laser.
I have my character firing a laser (prefab) at an enemy but it wont destroy the enemy gameObject. But it will destroy it when i have the laser prefabs box colliders “is trigger” unchecked but then the laser wont move across the the screen.
This is my code for my enemies class:
using UnityEngine;
using System.Collections;
public class Enemy : MonoBehaviour
{
void OnCollisionEnter(Collision collider)
{
if (collider.gameObject.tag == "laser")
{
Destroy(gameObject);
}
}
}
Can anyone help?