Misaki sorry for the delay, i had to do some digging into the code as this game was developed by another team and we are maintaining it now.
I don't think we are resetting the slots. We are just setting the animation when using it. Also, it seems the skins are being used on a weird way where the texture is replaced by another texture on the fly. (see example attached)
Here is the code to set the skin:
public void SetTextures(Texture textDown, Texture textUp, bool head)
{
if (head)
{
headDown.GetComponent<MeshRenderer>().material.mainTexture = textDown;
headUp.GetComponent<MeshRenderer>().material.mainTexture = textUp;
}
else
{
try
{
Debug.Log($"Setting up {textUp} / down {textDown}");
bodyUp.GetComponent<MeshRenderer>().material.mainTexture = textUp;
armUp.GetComponent<MeshRenderer>().material.mainTexture = textUp;
bodyDown.GetComponent<MeshRenderer>().material.mainTexture = textDown;
armDown.GetComponent<MeshRenderer>().material.mainTexture = textDown;
}
catch (Exception e)
{
Debug.LogException(e);
throw;
}
}
}
Here is the code to set the animation:
public void SetCorrectAttackAnimation()
{
if (this._baseItem.fullTroopData.alignAnimations)
{
this._baseItem.SpineRenderer.disableAutoUpdateAnimation = true;
this._baseItem.state = Common.State.ATTACK;
this._baseItem.SpineRenderer.SetAnimation("attack", false, this._baseItem.fullItemData.defenseConfig.attackTimeScale);
this._baseItem.LookAt(this._currentTarget);
}
else
{
this._baseItem.SetState(Common.State.ATTACK);
this._baseItem.LookAt(this._currentTarget);
}
}
This is the base texture
This is a skin in the game that is loaded in the fly and replaces the base avatar texture