Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active May 4, 2018 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/557192ecb49f17003298dc9518db5223 to your computer and use it in GitHub Desktop.
Save tsubaki/557192ecb49f17003298dc9518db5223 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class AutoSim : MonoBehaviour {
[SerializeField][Range(0.1f, 1.5f)] float speed = 0.1f;
private void Awake()
{
Physics.autoSimulation = false;
}
private void OnDestroy()
{
Physics.autoSimulation = true;
}
void FixedUpdate () {
Physics.Simulate(Time.fixedDeltaTime * speed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment