Hello I need help
I want to combine skins using a button click,
I can't figure out why the addSkin and findSkin are both underlined in red.
I'm really new to coding so any help will be appreciated. thanks
Stranica: 1/1.
Keempee_Artist
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
1 month ago
-
Keempee_Artist - Postovi: 6
ericn
I think you just have the capitalization wrong, should be FindSkin (capital F) and AddSkin (capital A) 

1 month ago
- ericn
- Postovi: 3
Keempee_Artist
Hi Ericn, I tried changing the F and A to capital letters as you said but I still getting an error.
Maybe I'm still missing some codes for it.
---
Hello, Here's a video of my scene. What I want to do is to combine my Hat skins with my Eyeglasses skins. Can anyone help me with the code here's what I currently have.
Maybe I'm still missing some codes for it.
---
Hello, Here's a video of my scene. What I want to do is to combine my Hat skins with my Eyeglasses skins. Can anyone help me with the code here's what I currently have.
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
1 month ago
-
Keempee_Artist - Postovi: 6
Harald
Please see the spine-unity documentation section here on combining skins:
spine-unity Runtime Documentation: Combining Skins
Please also have a look at the example scene
In general it's much recommended to check out all example scenes and the spine-unity documentation page if you run into any problems:
spine-unity Runtime Documentation
spine-unity Runtime Documentation: Combining Skins
Please also have a look at the example scene
Spine Examples/Other Examples/Mix and Match Skins
that comes with the spine-unity runtime.In general it's much recommended to check out all example scenes and the spine-unity documentation page if you run into any problems:
spine-unity Runtime Documentation
1 month ago
-
Harald - Postovi: 4014
Keempee_Artist
Thanks Harald the code from the documentation you sent is working but it is not exactly working the way I need it.
I need the skins to work like in this example. Sorry I know this just simple but I only know very little about coding.
I need the skins to work like in this example. Sorry I know this just simple but I only know very little about coding.
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
1 month ago
-
Keempee_Artist - Postovi: 6
Misaki
Please refer to
Select "Character (mix-and-match-pro)" GameObject to find the example script
Mix and Match Skins
as Harald told you:Screen Shot 2022-05-20 at 13.37.47.png
Select "Character (mix-and-match-pro)" GameObject to find the example script
MixAndMatchSkinsExample.cs
. As shown in the example script, not only the skin that has been changed, but also the skins that were already set up need to be added into the new skin to update the combination. For example, in your case, you would need the following code:public class CombineSkins : MonoBehaviour
{
[SpineSkin] public string hat = "";
[SpineSkin] public string eyeglasses = "";
SkeletonAnimation skeletonAnimation;
void Awake () {
skeletonAnimation = this.GetComponent<SkeletonAnimation>();
}
public void Ace(){
hat = "HatAce";
UpdateSkin();
}
public void Circle(){
eyeglasses = "EyeglassesCircle";
UpdateSkin();
}
void UpdateSkin () {
var skeleton = skeletonAnimation.Skeleton;
var skeletonData = skeleton.Data;
var characterSkin = new Skin("character");
if (!string.IsNullOrEmpty(hat)) characterSkin.AddSkin(skeletonData.FindSkin(hat));
if (!string.IsNullOrEmpty(eyeglasses)) characterSkin.AddSkin(skeletonData.FindSkin(eyeglasses));
skeleton.SetSkin(characterSkin);
skeleton.SetSlotsToSetupPose();
}
}
The above code does only the bare minimum. In practice, it is better to repack the atlas textures with just the used attachments as in the {
[SpineSkin] public string hat = "";
[SpineSkin] public string eyeglasses = "";
SkeletonAnimation skeletonAnimation;
void Awake () {
skeletonAnimation = this.GetComponent<SkeletonAnimation>();
}
public void Ace(){
hat = "HatAce";
UpdateSkin();
}
public void Circle(){
eyeglasses = "EyeglassesCircle";
UpdateSkin();
}
void UpdateSkin () {
var skeleton = skeletonAnimation.Skeleton;
var skeletonData = skeleton.Data;
var characterSkin = new Skin("character");
if (!string.IsNullOrEmpty(hat)) characterSkin.AddSkin(skeletonData.FindSkin(hat));
if (!string.IsNullOrEmpty(eyeglasses)) characterSkin.AddSkin(skeletonData.FindSkin(eyeglasses));
skeleton.SetSkin(characterSkin);
skeleton.SetSlotsToSetupPose();
}
}
MixAndMatchSkinsExample.cs
, and note that it is written for clarity anyway. I am not very familiar with C#, so Harald may add more information later.Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
1 month ago
-
Misaki - Postovi: 669
Keempee_Artist
It worked!! thanks for the help guys specially Misaki for writing it
---
Hello again another noob question. The way of combining my skins is correct as what Misaki suggested but is it possible to work that way when I got a blank attachment in the scene. Here's a screen capture.

---
Hello again another noob question. The way of combining my skins is correct as what Misaki suggested but is it possible to work that way when I got a blank attachment in the scene. Here's a screen capture.
Nemaš dopuštenje za pregledavanje privit(a)ka dodan(og)ih postu.
1 month ago
-
Keempee_Artist - Postovi: 6
Misaki
While it is possible to skin a blank attachment, perhaps would you like to remove the added skin? If so, you can do that just by emptying the skin name String. If I were to add to the code I posted here before, I would add the following method:
public void RemoveHat(){
hat = "";
UpdateSkin();
}
public void RemoveEyeglasses(){
eyeglasses = "";
UpdateSkin();
}
Then add a button for each part that calls the corresponding method in the scene.hat = "";
UpdateSkin();
}
public void RemoveEyeglasses(){
eyeglasses = "";
UpdateSkin();
}
1 month ago
-
Misaki - Postovi: 669
Mark topic unread
• Stranica: 1/1.
Natrag na Unity
- Vremenska zona: UTC