Created
May 18, 2014 01:19
-
-
Save capnslipp/acfec93b5763901d6893 to your computer and use it in GitHub Desktop.
Unity LateFixedUpdate pattern test script
This file contains hidden or 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; | |
using System.Collections; | |
public class TestLateFixedUpdate : MonoBehaviour | |
{ | |
void OnEnable() { | |
StartCoroutine("RunLateFixedUpdate"); | |
} | |
void OnDisable() { | |
StopCoroutine("RunLateFixedUpdate"); | |
} | |
IEnumerator RunLateFixedUpdate() { | |
while (true) { | |
yield return new WaitForFixedUpdate(); | |
LateFixedUpdate(); | |
} | |
} | |
int _updateCount = 0; | |
void Update() | |
{ | |
Debug.Log(this.GetType()+": Update #"+(++_updateCount)+" at "+Time.time); | |
} | |
int _fixedUpdateCount = 0; | |
void FixedUpdate() | |
{ | |
Debug.Log(this.GetType()+": FixedUpdate #"+(++_fixedUpdateCount)+" at "+Time.time); | |
} | |
int _lateFixedUpdateCount = 0; | |
void LateFixedUpdate() | |
{ | |
Debug.Log(this.GetType()+": LateFixedUpdate #"+(++_lateFixedUpdateCount)+" at "+Time.time); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test run output: