The code you posted above assumes I know the slot name, however that is what I am attempting to acquire. I have the skeleton, and I know the skin name, and I want to find the name of the slot that the skin is inside of.
DCalabrese

- 25 जुल. 2019
- 11 अक्टू. 2014 शामिल हुए
- संपादित
We are attempting to recolor Slots in our game, and in most cases our setup is working, however in a few cases the setup fails to find a slot. We are attempting to find the Slot that a Skin is located in. Our current method of doing that looks like this:
SlotName = animControl.skeleton.Data.Slots.Find(s => s.AttachmentName == SkinName).Name;
This however does not seem to be an accurate way of acquiring the slot data. What is the correct way to get the Slot that a Skin is located in?
Thank you!
For our game, we have characters with lots of clothing and body options. This works great at runtime. However, we want to be able to configure the settings in the editor. Our configuration tools all work great, and once the game is running the skins appear as they are supposed to. However, in editor mode, we are unable to get the skins to display at all. This is a feature that used to work about 6 months ago (or so), and no longer appears to function.
This is the method we use to rebuild our skins:
public void RebuildCustomSkin() { if (skeletonAnimation == null || skeleton == null) { Debug.Log(" --- SKIN BUILD ABORT --- " + gameObject.name); return; } customSkin.Clear(); foreach (PlayerAnimationSkin thisSkin in ActiveSkins) { Skin appSkin = skeleton.Data.FindSkin(thisSkin.SkinName); if (appSkin == null) { Debug.LogWarning(" --- No skin named " + thisSkin.SkinName + " found on skeleton of object " + gameObject.name); return; } else { customSkin.Append(appSkin); } } skeleton.SetSkin(customSkin); skeleton.SetToSetupPose(); animationStateComponent.AnimationState.Apply(skeleton); }
The PlayerAnimationSkin object is our own internal object that just stores some internal data about the skins (such as if it is displayed by default or not) - but the key element is that it has the 'SkinName' stored as a string. We have gone as far as making sure this method is called in the Update look of the editor by adding [ExecuteInEditMode] [ExecuteAlways] to the top of the object class, running UnityEditor.EditorApplication.QueuePlayerLoopUpdate(); in OnEnable, and also running UnityEditor.EditorApplication.QueuePlayerLoopUpdate(); in every Update loop to ensure it keeps getting updated.
In addition, what appears to be happening is that the SkeletonAnimation component is always erasing the settings in editor mode, and replacing them with whatever the value of "Initial Skin" is - based on watching the skin flash for a fraction of a second to the values we set, then return to whatever is set in Initial Skin on SkeletonAnimation.
Any pointers would be very helpful as this is a frustration for us.
Thank you!!
- RedVonix
- संपादित
- संपादित
We're in mid-production of a game, so naturally there are lots of changes and adjustments being done to Spine files. An issue we are finding however is whenever we replace the skeleton.json in Unity for an existing SkeletonDataAsset, it doesn't update. The only pipeline we've found that will do the update is going into the SkeletonDataAsset prefab for the object, setting the Skeleton JSON under SkeletonData to Null, and then re-applying the skeleton.json file.
Is there any way to make the SkeletonData do this automatically without us needing to constantly manually update every modified file? We've tried Reimporting the files but no luck.
Thanks!
TextureLoader IS in the spine namespace, yea. So I'll admit the issue confused me a little bit... removing NDATA fixed it, but yea... it shouldn't have been the problem, yet it was. =/
- Mitch लिखा
Mm well... the problem isn't in the Spine Unity runtime then. There's a conflict somewhere.
Do you have WINDOWS_STOREAPP or WINDOWS_PHONE defined anywhere?
(speaking about Compiler Directives)Other thought is do you have any other global classes called Atlas? :/
Only one class called Atlas and that is in Spine. Only Spine defines WINDOWS_STOREAPP and WINDOWS_PHONE.
Pharan लिखाUpdated to the latest Spine-C# too?
I've tried both the Spine-C# that was on GIT, and the one inside the spine-unity.unitypackage. Both had the same problem.
Figured it out! The problem was the NDATA plugin. It also has a class called TextureLoader, which was conflicting with Spine's TextureLoader. I'm thankfully not using NDATA yet in this project so I just removed it.
Thanks everyone!!
In a blank project it loads and compiles just fine.
Verifying things in my project...
- There is only one instance of Spine in the project.
- I do have a number of other assets in there, some of which do have global scripting defines.
However, in double-checking each class used there in the problem code, I'm not seeing any duplications of classes in the project.
I'm actually not even getting to the point of accessing those files. This is just from inputting the Spine runtime into Unity.
Unity 4.5.3f3, and I just downloaded it today. I've tried both the one from GIT and the .unitypackage version.
- संपादित
Got a bit of a strange problem (aren't they all strange though?
). When importing the needed files into an existing project, it fails to compile with the following errors:
Assets/spine-unity/AtlasAsset.cs(64,114): error CS1502: The best overloaded method match for `Spine.Atlas.Atlas(System.IO.TextReader, string, Spine.TextureLoader)' has some invalid arguments
Assets/spine-unity/AtlasAsset.cs(64,114): error CS1503: Argument
#3' cannot convert
MaterialsTextureLoader' expression to type `Spine.TextureLoader'First thought would be that this is conflicting with something in my project. Which chances are it is - because when I import the Spine files into a new project, the above error doesn't occur. However, in trying to track down the issue, the code being used is all within Spine or within Unity's main .NET levels. So I'm unsure of where to look next to fix the problem.
Reviewing the code, this is the part in AtlasAsset.cs that the above error occurs on:
atlas = new Atlas(new StringReader(atlasFile.text), "", new MaterialsTextureLoader(this));
Best I can tell, the Atlas object wants an object of type TextReader, not StringReader. I would go through and edit everything to function correctly, however I would prefer to work out the actual issue with you guys rather than coming up with a hack solution.
Any pointers as to how to correct this?
Thank in advance!