Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Animation Events with ECS

Discussion in 'Data Oriented Technology Stack' started by e199, Dec 6, 2018.

  1. e199

    e199

    Joined:
    Mar 24, 2015
    Posts:
    75
    How would you work with AnimationEvents?

    Is there any better approach than having monobehaviour on gameObject with Animator?
    For example when event A is received, monobehaviour will attach Component A using some first barrier in game loop.
    And when event B is received, it will attach Component B to that entity using same barrier.

    Near the end of the frame system is looking for those animation event components and removes them.

    I want to let my designer for example block player input when character does heavy attack
     
  2. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    501
    Well there is a thread about Events:
    https://forum.unity.com/threads/how-to-animate-in-ecs.524904/#post-3940981

    Maybe there is a good solution for you:
    Anyway: You have to use Mono for animation events to transmit them to ecs... What you also can do, instead of adding or removing a component, is just to set a flag in an existing component. This way you won't have to wait till the end of the frame...
     
  3. e199

    e199

    Joined:
    Mar 24, 2015
    Posts:
    75
    Yeah, I'm doing something similar for my collision handling events
    Seems like a mess with mono, hope when engine will be more ready for ECS it will support animation events as component data