Bullet Script (503103)

So i finally made my shooting script working…
Now what I want is to make the bullet disappear after a set amounts of seconds…
I am not really good at programming and I would appriciate any form of help

With no code, with no proper thought in the question, how do you expect people to answer?

Im asking for the code…
I want a timer that will count up to 3 for example and then destroy this gameobject…C# preferably

So… make a timer using Time.deltaTime and Object.Destroy and attach it to the bullet object?

Your question did not ask for code, but i assume you want something like this:

public class DestroyAfterTime : MonoBehaviour
{
    #region Public Fields

    public float DestroyTime = 15.0f;

    #endregion

    #region Private Methods

    private void Start()
    {
        Destroy(gameObject, DestroyTime);
    }

    #endregion
}

Thank you very much kind sir…:slight_smile:

Alternatively you could make it be destroyed on impact with any other object.

public class DestroyBullet : MonoBehaviour {

private void OnCollisionEnter(Collision collision){
if ( collision.gameObject){
Destroy(this.gameObject);

}
}
}