Search Unity

How to do OnAnimatorMove with ECS

Discussion in 'Entity Component System' started by HP, Aug 25, 2018.

  1. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    I've wrote a own movement method for moving my game object on the MonoBehaviour event OnAnimatorMove.
    Is it possible to do this without the MonoBehaviour in a ComponentSystem?

    As example there is a way for the MonoBehaviour event FixedUpdate like this:
    Code (CSharp):
    1.     [UpdateBefore(typeof(UnityEngine.Experimental.PlayerLoop.FixedUpdate))]
    2.     class MovementPhysicsSystem : ComponentSystem
    3.     {
    4.         struct Components
    5.         {
    6.             public Rigidbody rigidbody;
    7.             public Movement movement;
    8.         }
    9.  
    10.         protected override void OnUpdate()
    11.         {
    12.             foreach (var entity in GetEntities<Components>()) {
    13.                 MovementSystem.MoveFixedUpdate(entity.movement);
    14.             }
    15.         }
    16.     }
    17.  
    But the PlayerLoop has no AnimatorMove.
     
    thelebaron likes this.
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    It is currently not possible, you need to use MonoBehaviour to receive those events.
     
  3. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    Thanks for the clarification. I will then continue to use MonoBehaviour for this event until there is an official solution.