private void StopListening() { if (!_isListening) { Debug.LogError("Attempted to stop listening for updates while not listening. Did you forget to call base.Start() or base.OnEnable()?"); return; } if (_updateable != null) { ManagedUpdate.OnUpdate.RemoveListener(this); } if (_lateUpdateable != null) { ManagedUpdate.OnLateUpdate.RemoveListener(this); } if (_fixedUpdateable != null) { ManagedUpdate.OnFixedUpdate.RemoveListener(this); } if (_customUpdateable != null && _customUpdateIds != null) { for (var i = 0; i < _customUpdateIds.Length; i++) { ManagedUpdate.RemoveListener(_customUpdateIds[i], this); } } _isListening = false; }
private void StartListening() { if (_isListening) { Debug.LogError("Attempt at starting to listen for updates, while already listening. Did you forget to call base.OnDisable()?"); return; } var executionOrder = ExecutionOrder; if (_updateable != null) { ManagedUpdate.OnUpdate.AddListener(this, executionOrder); } if (_lateUpdateable != null) { ManagedUpdate.OnLateUpdate.AddListener(this, executionOrder); } if (_fixedUpdateable != null) { ManagedUpdate.OnFixedUpdate.AddListener(this, executionOrder); } if (_customUpdateable != null) { if (_customUpdateIds == null) { _customUpdateIds = _customUpdateable.GetCustomUpdateIds() ?? new int[0]; } for (var i = 0; i < _customUpdateIds.Length; i++) { ManagedUpdate.AddListener(_customUpdateIds[i], this, executionOrder); } } _isListening = true; }
private void LateUpdate() { ManagedUpdate.LateUpdate(); }
private void FixedUpdate() { ManagedUpdate.FixedUpdate(); }
private void Update() { ManagedUpdate.Update(); }