Forum rules - please read before posting.

Spine Skins

13»

Comments

  • Any idea why I am getting this error however?

    NullReferenceException: Object reference not set to an instance of an object
    Spine.Skin.AddSkin (Spine.Skin skin) (at Assets/Spine/Runtime/spine-csharp/Skin.cs:68)
    SkinSetter.LateUpdate () (at Assets/Sleepytime Village/Scripts/SkinSetter.cs:17)

  • I would guess that you are adding a Skin that does not exist / cannot be found.

  • Hey guys, thanks for the great work, I'm trying to use the script you made but I'm a bit stuck... I successfully import the scripts, I attached the SkinSetter to the child component of the main player, I added the skins name in the array but it doesn't work... if I check the Action in the ActionList Editor it reads only 1 skins under # of skins and I can't modify it. Any way to fix this? No wiki about this? It will be a great improvement for spine users.

  • Attach the SkinSetter component to your Player's root - not a child object.

  • Hey Chris, thanks for the answer, I've tried but I got this message "NullReferenceException: Object reference not set to an instance of an object
    Spine.Skin.AddSkin (Spine.Skin skin) (at Assets/Spine/Runtime/spine-csharp/Skin.cs:67)
    SkinSetter.LateUpdate () (at Assets/Bob/Scripts/SkinSetter.cs:17)"

  • edited November 2022

    My action:
    https://dropbox.com/s/e1o4f2upshoeptd/action.png?dl=0

    The player prefab
    https://www.dropbox.com/s/z9t04cka4vav0wq/playerprefab.png?dl=0

    The spine object inside the prefab
    https://dropbox.com/s/uuxwu4qjhlju9o8/spinegameobject.png?dl=0

    The character is spawned as player prefab
    It seems that The action doesn't care about how many skins I add, it's always on #1

  • I got this message "NullReferenceException: Object reference not set to an instance of an object

    The value entered into the "Skin #0" box needs to be the name of the skin - i.e. "pajama", "pants" - rather than the index.

    I have updated the SkinSetter script on the previous page with Console warnings if it encounters such an issue.

    It seems that The action doesn't care about how many skins I add, it's always on #1

    Are you pressing enter after updating the # of skins field?

  • ahhhh! thanks so much and sorry... I didn't think "enter" was the problem... now it works (it worked also before but I didn't know...)
    There's just a thing I don't understand, if I choose #4 skin I can see 4 text field where I can write down my skins and if I use it this way the character will have the last skin, but how to choose another one?
    Do I have to just write 1 and then write down the one skin I want? What's the purpose of the #of skins?

  • I also noticed a strange effect: if I use the player without the script (to change skin) the animations are corrects, but when I use the script it seems some parts of the animations are broken such as keyframed image order and visibility keyframing. In example eyeblink (made in spine with a visibility key) is ignored. Any idea about hot to fix it?

  • Do I have to just write 1 and then write down the one skin I want? What's the purpose of the #of skins?

    The Action will add each of the skins you specify in order to the skeleton - by calling Spine's own AddSkin command.

    Putting aside all the Action/AC specific code, the only functions it's calling on the Spine side are:

    Skeleton skeleton = skeletonAnimation.Skeleton;
    Skin newSkin = new Skin ("new-skin");
    foreach (string newSkinName in newSkinNames)
    {
        Skin existingSkin = skeleton.Data.FindSkin (newSkinName);
        newSkin.AddSkin (existingSkin);
    }
    skeleton.SetSkin (newSkin);
    skeleton.SetSlotsToSetupPose ();
    

    Where "newSkinNames" is the array of names you enter into the Action.

    Bear in mind though that this isn't part of any "integration" - it's a custom Action requested by another user, and may need to be adapted to suit your own needs. I'd recommend comparing your Inspector before/after the change, and testing the above code without AC's involvement. When you know what code exactly you want to run, we can see about adding it back into an AC Action.

  • Thanks a lot Chris and sorry for my late reply. Actually I was just searching a way to change skin via Action but I'm not a real coder so I just try to copy and paste and see what happen. Anyway thanks again, you are always helpful with your answers!

  • edited December 2022

    Ignore, updated ok

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.