• Editor
  • Can't assign attachments of the same slot to different skins

EDIT: I'm using Spine ESSENTIAL
Maybe I am dumb and misunderstood how skins work but I can't get it to work.
I have a gun with several attachments. I need to assign several accessories to a specific config. Each config has a skin.

When I try to assign the foregrips to a skin (both under the same slot) and switch between skins it shows only one whíle the other is invisible. It's just like toggle between them.
In this case:
The "Grip Folding" is assigned to the "QCB" skin.
The "Straight Foregrip" is assigned to the "SOCOM" skin.

Same with the "Supressor". It needs to be in QCB and SOCOM skin but not in the others.

If a I make separated slots for each one It works, but I guess that's not how is intended to work. Even if this way soves this problem, the gun image needs to be in all configs and duplicate slots and assign manually to each skin seems to be a pain in the **s.

What I'm doing wrong?

  • Nate odgovara na ovo.
    Related Discussions
    ...

    In Spine, each slot can only display one attachment at a time. When you switch skins, the attachment shown in a slot is determined by the skin placeholders and the active skin. If you have multiple attachments for a slot, you need to ensure that each skin has its own attachment under the skin placeholder. For your setup, you should have a single slot for the foregrips and another for the suppressors. Under each slot, you should have a skin placeholder for each attachment, and each skin should have its own attachment under these placeholders. This way, when you switch skins, the correct attachment for the active skin will be displayed.

    To achieve this, you can organize your slots and skin placeholders like this:

    foregrip (slot)
        foregrip placeholder
            QCB skin
                Grip Folding attachment
            SOCOM skin
                Straight Foregrip attachment
    
    suppressor (slot)
        suppressor placeholder
            QCB skin
                Suppressor attachment
            SOCOM skin
                Suppressor attachment

    This setup allows you to switch between skins and have the correct attachments displayed for each configuration without needing to duplicate slots.

    • Uređeno

    Spinebot did well this time. Please give that a try, with the info below, and let us know if you are still having trouble!

    SirBarrett If a I make separated slots for each one It works, but I guess that's not how is intended to work.

    A slot has one attachment or no attachment visible at any given time:
    https://esotericsoftware.com/spine-slots

    Since you have 2 pieces you want visible at the same time, you need 2 slots: foregrip and suppressor. If you have multiple types of foregrips or suppressors, you would put them in those slots for organization, since you can't have 2 foregrips or 2 suppressors visible at the same time.

    Similarly, you probably want to have a single slot for all sights.

    As a more complex example, if some sights are 2 pieces, you could have sight1 and sight2 slots, where sight2 has no attachment for most sights. Then, instead of having a sight "item" in your game represented as 1 attachment that you equip, you'd need to have it as multiple attachments. At that point it may be more convenient to have a skin per sight item. You can have multiple skins visible at the same time using the skins view:
    https://esotericsoftware.com/spine-skins-view
    At runtime you'd combine a bunch of skins to equip many items. This is an advanced step though, so get the basics of skins working first. See the mix-and-match example project for combining skins:
    https://esotericsoftware.com/spine-examples-mix-and-match

    SirBarrett Even if this way soves this problem, the gun image needs to be in all configs and duplicate slots and assign manually to each skin seems to be a pain in the **s.

    If you need an attachment in all skins, you can take it out of the skins instead (so it's not under a skin placeholder). If it needs to be in many skins but not all, you would put it in each of the skins where you want it. That doesn't involved duplicating slots.

    To reduce the pain when managing attachments across many skins, you can enable Show all skin attachments:
    https://esotericsoftware.com/spine-tree#Show-all-skin-attachments

    I can`t figure how to add that "skin" thing between the placeholder and the attachment in the project tree.

    Note I added some info to my answer above.

    You'll only see skins under the skin placeholders if you enable Show all skin attachments.

    That`s where my problem is.
    After I set a skin placeholder with it's respective attachment within it's respective skin active, and then switch between Skins in the skin list, the element -supressor in this case- shows in one skin but it shows nothing in the other one. I tried to click the clip icon to make the attachment visible but it makes the other attachment invisible in it's respective skin.

    That is correct. An attachment in one skin is not in other skins. If you want it in 2+ skins, you need an attachment for each skin. You can duplicate the attachment and put it in the other skin.

    You can either think of skins as a specific configuration of various attachments (as you seem to be doing) or you can think of skins as individual items, any combination of which can be shown.

      Nate That is correct. An attachment in one skin is not in other skins. If you want it in 2+ skins, you need an attachment for each skin. You can duplicate the attachment and put it in the other skin.

      In the first image, the QCB config must have a supressor -the one called supressorS-, after I assign the other supressor -supressor long- to the SHOOTER config It (supressorS) doesn't show on the QCB.

      Do I did something wrong?

      Sorry if I bother you with such basic questions, I come from another software and this is new to me.

      In you first screenshot the QCB skin is active. The SupressorLong placeholder is visible, which has no attachment, so no suppressor is shown.

      after I assign the other supressor -supressor long- to the SHOOTER config It (supressorS) doesn't show on the QCB

      It sounds like maybe you moved an attachment from one skin to the other. If you want it in both skins, duplicate the attachment and put a copy in the other skin.

      Be sure to read the slots documentation page and other links given above. As mentioned, enable Show all skin attachments to get a better view of what your skins contain.

      You may not need to use skins at all. Setup your slots and attachments so you can change attachment visibility to get various combinations. Show it here and we can comment on your organization.

      After that, if you want to use skins to store various combinations, create a skin and placeholders, and put copies of your attachments into the skin.

      If you have attachments that are in many skins, create one skin with the attachment, then duplicate the skin and fill in the rest of the attachments. That way you don't have to manually put it in each skin.

        I recorded a video to show you how I did it. I hope it helps to find what I'm doing wrong.
        I changed some names to make things easier to read, but the idea is the same.

        Nate You may not need to use skins at all. Setup your slots and attachments so you can change attachment visibility to get various combinations. Show it here and we can comment on your organization.

        I need to be able to change skins via code in construct 3 using the 3rd party runtime.

          SirBarrett Thanks for showing the video! Now I understand the point you are confusing. The correct way to add attachments to a skin placeholder is as follows:

          Please check the following explanation in the Spine User Guide carefully:

          The key to skins is the "skin placeholder", which is an attachment that goes under a slot in the tree, like any other attachment. However, it is just a placeholder for the actual attachment that will be used, which comes from the skins that are currently visible.

          Animations can show and hide skin placeholders just like they do attachments, by keying the slot attachment. By doing this, animations are not tied to showing and hiding specific attachments. Instead, animations show and hide skin placeholders and which attachments are actually shown comes from which skins are visible, enabling animations to be used with any skins.

          In other words, you should create a skin placeholder for each type of attachment you want to switch between in the animation. For example, if two mouth images are prepared for changing the character's facial expression, as shown below, the composition should be as follows:

          I hope this helps you.

          To add to Misaki's post:

          Skin placeholders appear for every skin. They are a placeholder for an attachment that comes from the active skin. The attachment in the placeholder is what is actually in the skin.

          The placeholder visibility is not part of the skin and is not affected when you change skins.

          As I wrote above, you should not have long supressor and short supressor placeholders. You should have a single placeholder called suppressor. In the long supressor skin put the long supressor attachment in the placeholder. Change to the short suppressor skin and put the short suppressor attachment in the placeholder. Now when you change skins and the suppressor placeholder is visible, you get either the short or long attachment.

          It is done this way because the skin is only providing the attachments. It is separate from what attachments and placeholders are visible. If your gun has a suppressor visible, when you change skins you get whatever supressor that skin has (or nothing if the skin has no attachment for the supressor placeholder).

          For another example, if my character has a hat placeholder visible, then the hat comes from the skin. When I change skins the hat changes.

          Which attachments are visible is like which accessories are equipped. That doesn't change when you change skins. Changing skins only changes how things look, by showing a different attachment (or none) for the same concept (eg a supressor).

          Now I see what my mistake was!
          I was able to do it. Thank you so much for taking the time to help me!
          You saved my life, haha.

          Great! 🥳

          Now IMHO you should take some time to plan your project. There are multiple ways to make various configurations for a skeleton. You could just assign which attachments are visible. You could use skins to design whole looks. You could use skins where each skin is a piece of the gun, then you show multiple skins at once to get various combinations. Which you use depends on the flexibility and how many combinations you need.

          If you will have hundreds or thousands of combinations, you can consider creating only attachments to use as a template in the Spine editor, then at runtime generate the attachments from loose images files, described here. That way you can add new items just by adding image files, without having to rig each attachment in the Spine editor.