I’d like to be able to pause my game using the Time class, yet still be able to move the camera in my scene around without varying speeds. Should I put in a second timer that my camera can refer to instead of Time, or is there an easier way? If there isn’t an easier way, where should I look to get started?
I think I’ve manage to convince Joe of the usefulness of a Time.realDeltaTime, but until then you can properly get away with attaching something like this to a gameObject in the scene and using RealTime.deltaTime for the camera code.
using UnityEngine;
using System.Collections;
public class RealTime : MonoBehaviour {
private static float lastFrameEnd = 0;
private static float _deltaTime = 0;
public static float deltaTime {
get {
return _deltaTime;
}
}
void LateUpdate() {
_deltaTime = Time.realtimeSinceStartup - lastFrameEnd;
lastFrameEnd = Time.realtimeSinceStartup;
}
}
Super. I always know my problem’s been solved when I see your name among the responses.
No prop. I just wish I had more time to help other people on the forum, but after staring at Unity for 8-14 hours at work I’m usually inclined to do something else in my spare time :-).