- Edited
Repacked Skin with RenderExistingMesh cause weird result.
Hi,
Apology for my bad grammar.I am not native English speaker.
I make a character with customize equipment (mix&match). Everything work fine.
And when i combine with outline shader. Using RenderExistingMesh.cs cause the outline mesh to not align correctly with the base mesh.(it magically flipped)
This is the code i use after customize skin.
private void RepackSkin()
{
var repackedSkin = new Skin("repacked skin");
repackedSkin.AddAttachments(skeleton.Data.FindSkin("01_basicSkin"));
repackedSkin.AddAttachments(customSkin);
if (runtimeMaterial != null)
Destroy(runtimeMaterial);
if (runtimeAtlas != null)
Destroy(runtimeAtlas);
repackedSkin = repackedSkin.GetRepackedSkin(repackedSkin.Name, sourceMaterial, out runtimeMaterial, out runtimeAtlas);
skeleton.SetSkin(repackedSkin);
var outlineMaterial = renderExistingMesh.replacementMaterials[0].replacementMaterial;
outlineMaterial.mainTexture = runtimeAtlas;
outlineMaterial.SetInt("_OutlineReferenceTexWidth", runtimeAtlas.width);
outlineMaterial.SetFloat("_OutlineWidth", runtimeAtlas.width / 256f);
}
Default outline.
After call RepackSkin.
Repack with custom skin.
I forgot to point out that i need help. I have no idea what I am doing is wrong.
If you need more clarity please ask for. I will try my best to explain.
No need to apologize.
Could you please send us a minimal Unity project that still shows this issue, as a zip package to contact@esotericsoftware.com? Then we can have a look at it what exactly goes wrong.
Thank for your response, and sorry for my late reply.
I have sent you a minimal project (as possible as I can) to the email.
Thank you very much to give me a hand on this.
Thanks for sending the reproduction package. We will have a look at it and get back to you as soon as we've figured out what is going wrong.
It seems as if the outline Material asset Player Character_Outline_Material
(the green one) causes some weird behaviour. I noticed that the second outline Material Player Character_Outline_Material 1
(the blue one) does not show the problems. Strangely after copying Player Character_Outline_Material 1
to Player Character_Outline_Material 2
and copying the Material properties via Inspector Gear Icon - Copy Material Properties
and Paste Material Properties
to the new outline material, everything worked as expected. This could have been due to any kind of asset corruption or a similar effect.
So in short, please remove the problematic green outline material and re-create it.
Thank for the inspection. I did it as you said and it really fixed.
That indeed really wired behavior. It not even relate to a Spine.
Thank again for the help and sorry to trouble you with this unrelated topic.
Glad we could resolve it easily. Sometimes asset management systems produce strange mysteries.
Hi, I got the follow up problem not relate to the outline one but it close enough. And I don't want to create a new topic for it.
With my runtime repack skin code above. It's broken on standalone build. Both with Mono and IL2CPP backend script.
I don't know what wrong with my code or my exported character. I have extracted minimal project ready in case you need it.
Test with
Spine version 3.8-2021-02-22
Unity version 2019.4.19f1
Here an executable in case anyone curious
While we haven't checked out your reproduction project yet, perhaps you find one of the typical errors listed on the spine-unity documentation pages to be the reason of your problem, see the note box starting with
"Important Note: If repacking fails or creates unexpected results, it is most likely due to any of the following causes:"
That's it. Thank for the quick reminder and sorry for my neglect such a simple fact.
I did change a lot of project structure and never re-check the import setting of each files. Because it work fine on editor that I never notice until now.
Glad to hear you've figured it out, thanks for letting us know.