Simple and fast Update, FixedUpdate, LateUpdate callbacks alternative, based on PlayerLoop API
Inherit LoopBehaviour and implement IUpdateLoopElement or IFixedUpdateLoopElement or ILateUpdateLoopElement
class Looped : LoopBehaviour, IUpdateLoopElement, IFixedUpdateLoopElement, ILateUpdateLoopElement {
public void OnUpdate() {
// Update stuff
}
public void OnFixedUpdate() {
// FixedUpdate stuff
}
public void OnLateUpdate() {
// LateUpdate stuff
}
}
class Looped : MonoBehaviour {
private Disposables subscription;
private void OnEnable() {
subscription += Loops.Update.Start(OnUpdate);
}
private void OnDisable() {
subscription.Dispose();
}
private void OnUpdate() {
// Update stuff
}
}