Question by
HeldomLtd · Mar 25, 2018 at 01:20 AM ·
error messagetimetimescale
Getting Error: 'Time' does not contain a definition for 'timeScale'
So I was working on a different script when this error popped up, I didn't even save the script and the error popped up. I am trying to figure out why it is wrong because it worked before and everyone else's is working fine. Here is the script with the error
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityStandardAssets.Characters.FirstPerson {
public class PhoneSystem : MonoBehaviour {
public GameObject phonePickedUp;
public GameObject phoneCanvas;
public bool phoneUp = false;
public GameObject player;
// Update is called once per frame
void Update() {
if (Input.GetKeyDown(KeyCode.E))
{
if (phonePickedUp.GetComponent<Phone>().phone == true)
{
if (phoneUp == false)
{
Time.timeScale = 0;
phoneCanvas.SetActive(true);
player.GetComponent<FirstPersonController>().PlayerStop();
phoneUp = true;
} else
{
Time.timeScale = 1;
phoneCanvas.SetActive(false);
phoneUp = false;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
}
}
}
}
}
Comment
Oh wait I found the problem. The script that I made was named "Time". I had to rename it and now it works.
Your answer
Follow this Question
Related Questions
Load scene after time 1 Answer
Wait time after coroutine's wait seconds is complete 0 Answers
Problem setting Time.timeScale to 1 after being set to 0 0 Answers
How to use time, when timeScale is 0? 2 Answers
Time.timeScale is 0 but game not frozen 0 Answers