Hi all
I’ve been experimenting with using pure ECS (including hybrid rendering, physics), which works great so far.
Now, I’ve tried to see how close I could get to pure ECS animations. I’m assuming that Unity is not there yet, apart from baking animations into textures etc.
To animate, I’m using the excellent c# animation jobs, that I start from a system:
using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
namespace BUD.Animations
{
public struct HumanoidMixerJob : IAnimationJob
{
public NativeArray<TransformStreamHandle> handles;
public NativeArray<float> boneWeights;
// Weights. These are updated and passed to this job.
public float stance;
public float velocity;
public float rotation;
public void ProcessRootMotion(AnimationStream stream)
{
// ...
}
public void ProcessAnimation(AnimationStream stream)
{
// ...
}
}
}
However, since I need bones from an avatar, I currently need an Animator, which to my knowledge I can’t attach to an entity. And so I have to give up running it on pure, and instead move to hybrid:
var entity = entityManager.CreateEntity(infantryArchetype);
var go = Object.Instantiate(infantryPrefab);
// Connect the entity and the GO.
GameObjectEntity.AddToEntity(EntityManager, go, entity);
// Setting other components here.
// Animation
entityManager.SetComponentData<HumanAnimation>(entity, new HumanAnimation()
{
stance = 0.0f,
velocity = 1.0f,
rotation = 0.0f,
});
var animator = go.GetComponent<Animator>();
// HumanoidAnimation handles setting up the job correctly.
var humanoidAnimation = new HumanoidAnimation(animator);
// AnimationSystem is just a dictionary where I remember which entity
// owns the animation+animator.
// I am aware that using entity.Index is not a good idea, but it's good enough
// for experimenting.
AnimationSystem.animations.Add(entity.Index, humanoidAnimation);
But, if I do this, of course I’ll get two visible objects. An animated GO and a non-animated entity that is rendered via hybrid.

I’d like to get as close to pure ECS as possible so that I can switch to whatever pure ECS animator+avatar is released at some point in the future, but so that I can continue working with what I have at the moment. From forum entries I see that they were initially planned for sometime now and that they are working on it.
The options I see:
- Move to hybrid, and do not use the hybrid renderer so that I only work with the GO.
- Somehow animate the entity by somehow connecting the animator/avatar/bones to the entity (I assume that’s not possible)?
- Forget animations for now and work on something else.
- Or, one of you has an idea on how to get closer to pure ECS? (Sadly, baking the animations into textures is not yet an option as I need the animations to be quite dynamic/blended)
Many thanks in advance!