- Uređeno
Create Sprite of Given Frame at Runtime?
Hi all,
I've animated enemies to use in Unity and I'd like to have their corpses stick around for a long time before eventually fading them out and repooling. I was thinking it would probably be best to disable the enemy GameObject upon finishing the death animation and replace it with a simple sprite of its current skin/pose. This way, I might not even need to remove corpses at all (maybe?). The problem is I plan on eventually having lots of randomized skins and several different death animations, so I can't load the sprite ahead of time. Is there a way to create a sprite of a given frame during a Spine animation? I know the new version of Spine has a feature where you can export images of an animation, but that's a little bit different.
Thanks.
Hi,
Since Spine renders using Unity's mesh-based Renderer components, there is no kind of "current frame" image available for a given Skeleton out of the box.
What you want to achieve is render a certain state of a mesh down to a texture, which can be achieved in Unity by using a RenderTexture. You can find a short description at the bottom of this thread (regarding transparency fade-out of a character):
Help plz! How do I make my character translucent in Unity?
Maybe there is a package available on the Unity Asset Store to do this more comfortably, search tags could be "render texture" or "impostor".
Maybe this package would be interesting, it is not free and I haven't tested it though:
https://assetstore.unity.com/packages/tools/utilities/amplify-impostors-beta-119877
Okay, thanks for the info I'll definitely check out RenderTexture. I look forward to seeing the example scene you plan on putting out
Great to hear.