Tuesday, February 5, 2019

Timer script for start game in unity C# [ 3,2,1,and start ] by allunityscripts

Start Game Before Time


unity start game timer effect



 using System.Collections;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.SceneManagement;

public class StartGame : MonoBehaviour
{

    public float timeLeft = 3.0f;
    public Text startText; // used for showing countdown from 3, 2, 1 
    public GameObject Image;
public GameObject count;

    void Update()
    {
        timeLeft -= Time.deltaTime;
        startText.text = (timeLeft).ToString("0");
        if (timeLeft < 0)
        {
         Image.SetActive(true);
count.SetActive(false);
        }
    }
}


                                          

No comments:

Post a Comment