unity slow code example
Example: unity slow motion
using UnityEngine;
public class TimeManager : MonoBehaviour
{
public float slowdownFactor = 0.05f;
public float slowdownLength = 3f;
void Update()
{
Time.timeScale += (1f / slowdownLength) * Time.unscaledDeltaTime;
Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f);
}
void doSlowmotion()
{
if(OVRInput.GetDown( //input ))
Time.timeScale = slowdownFactor;
Time.fixedDeltaTime = Time.timeScale * .02f;
}
}