Noeski Hmmm, I'm not entirely sure what AttachAll()
does, so depending on that, this may or may not be helpful. However, if you want to ensure that the skin is only updated when the new skin differs from the current one, you could write the function like this:
public void SetNewSkin(Skin newSkin){
Skin previousSkin = skeletonAnimation.Skeleton.Skin;
if (newSkin == previousSkin){
Debug.Log("No changes made as the new skin is the same as the current skin: " + previousSkin.Name);
}
else{
skeleton.SetSkin(newSkin);
skeleton.SetSlotsToSetupPose();
}
}
If AttachAll()
involves combining multiple skins, you might want to assign a unique name to the combined skin (e.g., concatenate the names of the combined skins). This way, you can compare the names of the current skin and the new skin to decide if an update is necessary.
Additional Notes: When posting code, we recommend using text instead of images. Text allows others to test and debug your code more easily.