Hi all im using this code… to dictate the visibility of to public game objects
using UnityEngine;
using System.Collections;
public class PauseScript : MonoBehaviour {
public GameObject transGray;
public GameObject playButton;
public bool paused;
void Start ()
{
paused = false;
playButton.GetComponent<Renderer>().enabled = false;
transGray.GetComponent<Renderer>().enabled = false;
}
void Update ()
{
}
public void Pause()
{
paused = !paused;
if (paused)
{
Time.timeScale = 0f;
playButton.GetComponent<Renderer>().enabled = true;
transGray.GetComponent<Renderer>().enabled = true;
}
else if (!paused)
{
Time.timeScale = 1f;
playButton.GetComponent<Renderer>().enabled = false;
transGray.GetComponent<Renderer>().enabled = false;
}
}
}
Im having this error when i play the game… and it is always whatever function i have on top of the other…
I thought it was just that the object didn’t have anything assigned to it… but it does:
Please Help!! Thanks! -Ross