I have a Character Script with a AnimationSettings list. The nameAnimation of all elements on the list shows the animations names of the same SkeletonAnimation even if I change the SkeletonAnimation on the variable that the datafield points to.
Note: I have children with Skeleton Animation's on GameObject where Character script is attached.
I have the following from code this post: http://pt.esotericsoftware.com/forum/Custom-Editor-List-of-Lists-and-Spine-Animation-Attribute-10030
[System.Serializable]
public class AnimationSettings
{
public SkeletonAnimation skeletonAnimation;
[SpineAnimation(dataField: "skeletonAnimation")]
public string nameAnimation;
public bool loop;
public float speed;
public AnimationSettings(SkeletonAnimation skeletonAnimation, string nameAnimation = "", bool loop = false, float speed = 1.0f)
{
this.skeletonAnimation = skeletonAnimation;
this.nameAnimation = nameAnimation;
this.loop = loop;
this.speed = speed;
}
}
public class Character : MonoBehaviour
{
//* Spine
public SkeletonAnimation currentSkeletonAnimation;
public List<SkeletonAnimation> skeletonAnimations = new List<SkeletonAnimation>();
public List<SkeletonDataAsset> skeletonDataAssets = new List<SkeletonDataAsset>();
//* Animation Setting List
public List<AnimationSettings> movementLayer = new List<AnimationSettings>();
}