private void OnApplyMotion(SpineAnimatorRootMotion rootMotion, Vector2 localDelta) { //Only apply root motion if this is the last rendered animator if (_lastRenderedAnimationSet != null && _lastRenderedAnimationSet._animatior.gameObject == rootMotion.gameObject) { if (_onMotion != null) { _onMotion.Invoke(_lastRenderedAnimationSet, localDelta); } } }
private void Start() { if (_renderer != null) { _renderer._onRenderAnimationSet += OnRenderAnimationSet; for (int i = 0; i < _renderer._animationSets.Length; i++) { SpineAnimatorRootMotion rootMotion = _renderer._animationSets[i]._animatior.GetComponent <SpineAnimatorRootMotion>(); if (rootMotion != null) { rootMotion._onMotion += OnApplyMotion; } } } }