Hi!
I am making a skin system and I want to preview the skins. For that, I create skin cards that have the skin id that then calls a method to change the skin.
A skin is based on many parts (body, helmet, jetpack, and jetpack trails)
If I click the card, I can see the new skin updated but sends later, the skin disappear and the default one appear again.
The default skin is a Skin that I get from a json (a string array with the skins ids) and I am using the same code as when I change skins.
This is an example of the code to change a full body skin (body and helmet/face).
`

  public void SwitchFullBodySkin(string bodySkinSelected, string helmetSkinSelected)
  {
        currentBodySkin = bodySkinSelected;
        currentHelmet = helmetSkinSelected;
        Skeleton skeleton = null;
        if (GetComponent<SkeletonAnimation>())
        {
            SkeletonAnimation skeletonAnimation = GetComponent<SkeletonAnimation>();
            skeleton = skeletonAnimation.Skeleton;
        }
        else if (GetComponent<SkeletonGraphic>())
        {
            SkeletonGraphic skeletonGraphic = GetComponent<SkeletonGraphic>();
            skeleton = skeletonGraphic.Skeleton;
        }
        SkeletonData skeletonData = skeleton.Data;

        Skin newSkin = new Skin("New Skin");
        newSkin.AddSkin(skeletonData.FindSkin(bodySkinSelected));
        newSkin.AddSkin(skeletonData.FindSkin(helmetSkinSelected));
        newSkin.AddSkin(skeletonData.FindSkin(currentJetpack));
        newSkin.AddSkin(skeletonData.FindSkin(currentJetpackTrail));

        // Set and apply the Skin to the skeleton.
        skeleton.SetSkin(newSkin);
        skeleton.SetSlotsToSetupPose();

        if (GetComponent<SkeletonAnimation>())
        {
            SkeletonAnimation skeletonAnimation = GetComponent<SkeletonAnimation>();
            skeletonAnimation.AnimationState.Apply(skeleton);
        }
        else if (GetComponent<SkeletonGraphic>())
        {
            SkeletonGraphic skeletonGraphic = GetComponent<SkeletonGraphic>();
            skeletonGraphic.AnimationState.Apply(skeleton);
        }
    }

`
AND I am not starting any animation runtime, I am just using the initial animation that I can set on the SkeletonAnimation / Skeleton Graphic option.

Related Discussions
...

@JeeTP I can see nothing obviously wrong with the code you shared above. So likely your other gameplay code is doing something wrong. We would recommend debugging your code (likely there are undesired calls to SwitchFullBodySkin or other skin-relevant calls) or stripping your code down to the minimum and checking if the issue still persists without any UI or gameplay layers present.

    Harald
    Omg, you are right!
    I was calling 2 times to my SwitchFullBodySkin, one with the new data and one with the default data that I get from a json.
    I never thought about it until I read your comment, so thank you!!

    @JeeTP Glad to hear you've figured it out, thanks for getting back to us! 🙂