Right now the code I have disable game object . What I ment to do is pause and unpause game object .When the scene plays I don’t see the game object because the whole body is disable . I don’t want that . I want to be able to see the gameobject and not be able to move the gameobject . I also gonna have music . I need that pause to too. I just want to be able to pause and unpause the player and the enemy ai’s and weapons. Anything that is gonna move I want it to be pause and unpause for a couple of seconds . Here is my code :
using UnityEngine;
using System.Collections;
public class yu : MonoBehaviour {
public float disableTime = 5f;
private float t = 0f;
// Use this for initialization
void Start () {
StartCoroutine(DisableGameObjects());
}
private IEnumerator DisableGameObjects() {
Transform[] transforms = GetComponents<Transform>();
foreach(Transform tr in transforms) {
tr.gameObject.SetActive(false);
}
yield return new WaitForSeconds(disableTime);
foreach(Transform tr in transforms) {
tr.gameObject.SetActive(false);
}
}
}