I’m trying to make a gun, but I’d like the bullets to be destroyed whenever they hit anything.
Current code is:
using UnityEngine;
using System.Collections;
void OnCollisionEnter(Collision a)
{
Destroy(this);
}
This doesn’t work. I’ve tried other stuff, like destroy gameObject, but that doesn’t work either. What would work? Am I forgetting a step?
Are you saying I should add a force to the wall to push back? Sorry, I'm fairly new to Unity.
– shmeeb