Wait and then.... Script

Hi I want to freeze the game but to freeze it I need to click and click is my button to fire and so it summons a “bullet” and then after that freezes the game before the bullet instantiated and so i somehow I need to tell the script to wait a bit so that Unity has enough time to Instantiate the bullet and then after the wait time is over he can destroy the bullet but I don’t know how.

        else {
            GameObject.Find("Live1Icon").GetComponent<SpriteRenderer>().enabled = false;
            GameObject.Find("Live2Icon").GetComponent<SpriteRenderer>().enabled = false;
            GameObject.Find("Live3Icon").GetComponent<SpriteRenderer>().enabled = false;
            GameObject.Find("Main_Player_LVL1").GetComponent<SpriteRenderer>().enabled = false;
            //wait 1/4 second and do the following:
            Destroy (GameObject.Find ("Player_Shot_LVL1"));
        }
    }

shouldnt the bullet be in charge of destroying its self, and to do so you could make a simpler timer into the bullets Update method, using Time.time and Time.deltaTime.

They bullet its self, should really be incharged if its own movmeant and be killing its self.

I wil try doeing so, thanks for the suggestion

Thanks that solved my problem, I did not think that will worked but it did thank you!

ya a simple script like this should do the job.

using UnityEngine;
using System.Collections;

public class AutoDes : MonoBehaviour
{
    [SerializeField]
    private float lifeTime = 3f;
    private float curTime;

    private void Start()
    {
        curTime = 0f;
    }

    private void Update()
    {
        curTime += Time.deltaTime;
        if (curTime >= lifeTime)
            Destroy(gameObject);
    }
}

lifeTime is how long you want the bullet to live in seconds.