Thank you, the solution with RenderExistingMesh.cs works acceptable for me. It has some little drawbacks:
I am not sure why, but i need manually add all my 10 skeleton materials as replacment materials to RenderExistingMesh-component, just where each material "replaces itself". And if i update my atlasses/materials, then i need do not forget to update this replacment lists too.It looks like this (right magenta), if i just leave replacment list empty:
Unfortunately referenceMaterial can not be just reassigned at runtime. Since there are four characters in the game party, I had to make one copy for each and hide all the rest. If i just reassign reference at runtime, i get this:
Loading Image (Reset in Inspector does not help, Adding sorting-group-component does not work too). Together with point above i need update all 4 replacment lists. Not a big deal, but there is a risk just to forget to do it manually after some player adjustments.
One more thing, since i use this player big preview on game pause, i need to update skeletonAnimation manually with unscaled time. SkeletonAnimation has no "unscaled time" in Advanced options, like SkeletonGraphics. Found the solution here: http://en.esotericsoftware.com/forum/Time-timeScale-and-still-play-animation-on-specific-object-9054
And one little problem more: Since SkeleotnAnimation is used in UI, it works. But it was not that easy to render object inbetween of UI elements. Only behind or on top. On top would be OK in most cases, but i need to draw context help on top of everything. Solved it just by using
You could create your own adaptation of the script that uses a CanvasRenderer as a target.
I did not change RenderExistingMesh.cs at all and it seems to work anyway. Why should i modify it?
One drawback here is however that all animations are also mirrored, which is not what you may want.
Mirrored? Do you mean there is no flip? In my case it is exactly what i want. Even if player looks left, i want the inventory-preview to be alwasy unflipped.
Or do you mean played in reverse as "mirrored"? If so... no just tested it on walk animation, it will be played exactly as referenceMaterial in forward order.
Copying the attachment state over should be the easiest solution here. Your game state classes should be designed...
Well, probably you are right. I need implement such functionality for Inventory anyway. I just not sure what to do first: GUI or RpgSys with invetnroy, stats etc. So i decided to start with GUI and attachment-mangment is just not ready for now. But SkeletonGraphics with synchronized attachments should do the same task more easily and probably does not need 4 workarounds listed above. But for now RenderExistingMesh seems to work fine.
P.S.
While you could query the in-game SkeletonAnimation skeleton's Skin for active attachments, this is not the clean and recommended way.
I have tryed it with this code:
string str = "";
foreach (var skin_entry in SkeletonAnim.Skeleton.Skin.GetAttachments()) {
str += skin_entry.Name + " -> " + skin_entry.Attachment.Name + "\n";
}
Debug.Log(str);
But it only lists skin-attachments. In my rig all skins have common armor/weapons as attachments that belong to no skin. So they are not listed here.