Collision Detection issue

Hi all, Im really new to Unity (just started a few weeks ago) and Im making a simple FPS game in which the player has a gun and can shoot things. My problem is when I fire a bullet at an enemy, the collision detection sometimes works. Other times the bullet will go right through the enemy. I have the bullet set to detect if it hit an enemy and it works, but like I said, it only works sometimes. Am I using too high a speed for the bullet? Or is it something else? Please excuse my beginner mistakes! :slight_smile: My code:

using UnityEngine;
using System.Collections;

public class Bullet : MonoBehaviour 
{
	private float speed = 50.0f;

	// Use this for initialization
	void Start() 
	{
		//...
	}
	
	// Update is called once per frame
	void Update() 
	{
		transform.Translate(0, 0, speed * Time.deltaTime);
	}

	void OnTriggerEnter(Collider other)
	{
		if(other.GetComponent<ReactiveTarget>())
		{
			Debug.Log("Target hit");
		}
		Destroy(this.gameObject);
	}
}

You may want to set up continuous collision detection. The default “discrete” mode checks collision once per frame, and may miss fast-moving objects like bullets. Continuous collision is more expensive on the CPU, but catches things like this.