Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Animation Events with ECS

Discussion in 'Entity Component System and C# Job system' started by e199, Dec 6, 2018 at 12:41 PM.

  1. e199

    e199

    Joined:
    Mar 24, 2015
    Posts:
    52
    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:
    400
    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:
    52
    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