On line 43 in the Resume method ( Time.fixedDeltaTime = initialFixedDelta ) I get a compile error "An object reference is required to access non-static member ‘GameManager.initalFixedDelta.’ As far as I can tell I have the same setup Ben has but I get this error. I see by the print statement that I am retrieving the initialFixedDelta of 0.2, but it won’t let me put it back in! I don’t know what I need to add here since Ben hasn’t added anything else ( as far as this part is concerned) either!
I would appreciate any and all help. Thanks.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
public class GameManager : MonoBehaviour {
public bool recording = true;
private bool paused = false;
private float initialFixedDelta;
void Start(){
initialFixedDelta = Time.fixedDeltaTime;
print (initialFixedDelta);
}
// Update is called once per frame
void Update () {
if (CrossPlatformInputManager.GetButton ("Fire1")) {
recording = false;
} else {
recording = true;
}
if (Input.GetKeyDown (KeyCode.P) && paused == false) {
paused = true;
PauseGame ();
} else if(Input.GetKeyDown (KeyCode.P) && paused == true) {
paused = false;
ResumeGame ();
}
}
static void PauseGame (){
Time.timeScale = 0;
Time.fixedDeltaTime = 0;
}
static void ResumeGame (){
Time.timeScale = 1;
Time.fixedDeltaTime = initialFixedDelta;
}
}