Almost have this working... The code is very similar to what I've done in spine_c and rust.
This is a test:
var skeletonAsset = handle.Result;
var skeletonAnimation = SkeletonAnimation.AddToGameObject(characterGO, skeletonAsset);
skeletonAnimation.Initialize(true);
// skeletonAnimation.AnimationState.SetAnimation(0, "idle", true);
var attachmentRegion = skeletonAsset.atlasAssets[0].GetAtlas().FindRegion("human_body_01");
Assert.IsNotNull(attachmentRegion);
Debug.Log("region: " + attachmentRegion.name);
var regionAttachment = new RegionAttachment("human_body_01")
{
Region = attachmentRegion,
Width = 1f,
Height = 1f,
X = 0f,
Y = 0f,
ScaleX = 1f,
ScaleY = 1f,
Rotation = 0f
};
regionAttachment.UpdateRegion();
var skeleton = skeletonAnimation.Skeleton;
var slot = skeleton.FindSlot("body");
Assert.IsNotNull(slot);
var slotIndex = slot.Data.Index;
Debug.Log("Body slot index: " + slotIndex);
var characterSkin = new Skin("character-base");
characterSkin.SetAttachment(slotIndex, "human_body_01", regionAttachment);
skeleton.SetSkin(characterSkin);
skeleton.SetSlotsToSetupPose();
skeletonAnimation.AnimationState.Apply(skeleton);
skeleton.UpdateWorldTransform(Skeleton.Physics.Update);
There are no errors, but the new region attachment doesn't appear. I know the character is there due to a reference region attachment that's exported which shows up.
Is there a step I'm missing? Maybe re-generating the skeleton data in some way?