DOTS tools to handle Animator

I have made some DOTS helpers to play around with Animator component.

It can be found here on GitHub GitHub - Parabole/AnimatorSystems: DOTS helpers for communicating with the Animator, and its purpose is to allow jobbed systems to interact with the Animator component.

Think of it as a middle man that receives instructions and then apply it to the Animator. It also mirror some information such as the current AnimatorStateInfo in IComponentData.

I’m sharing it because I think there are not enough examples of hybrid usage in the forums and it may help people learning to use Dynamic Buffer and things like that.

Here is an example job that sets four parameters on all animators.

    private struct TestJob : IJobForEach_BBBB<BoolParameter, TriggerParameter, FloatParameter, IntParameter>
    {
        public int BoolHash;
        public int TriggerHash;
        public int FloatHash;
        public int IntHash;
       
        public void Execute(DynamicBuffer<BoolParameter> setBool,
            DynamicBuffer<TriggerParameter> setTrigger,
            DynamicBuffer<FloatParameter> setFloat,
            DynamicBuffer<IntParameter> setInteger)
        {
           
            BufferUtils.AddBool(BoolHash, true, setBool);
            BufferUtils.AddFloat(FloatHash, 99, setFloat);
            BufferUtils.AddInteger(IntHash, 77, setInteger);
            BufferUtils.AddTrigger(TriggerHash, setTrigger);
        }
    }

Note that some of these things might not be super efficient and that I do not intend to officially support the package / fix reported bugs. We use this internally for our game development and just thought it would be nice to share it with the community.

The package will also become irrelevant as soon as Unity deploys its DOTS Animatoré

3 Likes

Nice work. We actually did something very similar in my project.

Depending on what features ship with the DOTS animation package this will probably be useful for some time still. :slight_smile: