For example, my character has a ability to transform to a dragon from human.
I have created a SkeletonAnimation instance in game, then I want to change its SkeletonDataAsset to another SkeletonDataAsset .
(I know I can use two gameobjects to achieve this, but I just want to know can that be possible.)
This is my code, and in fact it works.
I want to know is this a correct way to do this?
public SkeletonDataAsset data1;
public SkeletonDataAsset data2;
void ChangeToDataAsset1()
{
SkeletonAnimation sa = GetComponent<SkeletonAnimation>();
sa.skeletonDataAsset = data1;
sa.Initialize(true);
}
void ChangeToDataAsset2()
{
SkeletonAnimation sa = GetComponent<SkeletonAnimation>();
sa.skeletonDataAsset = data2;
sa.Initialize(true);
}