Last active
May 4, 2018 10:38
-
-
Save tsubaki/557192ecb49f17003298dc9518db5223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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