markcky2433 The SkletonRenderTextureFadeout
provided by the spine-unity runtime is pretty easy to use, so I'm not sure what you're having trouble with.
To be clear, I have uploaded a video showing how to use it here:
First add a SkeletonRenderTexture
component to the skeleton GameObject you want to fade out, then add a SkeletonRenderTextureFadeout
. This will start the fade-out as soon as it is enabled, so you might want to attach it with it disabled by default and enable it when you perform the fade out effect. SkeletonRenderTexture
should also be disabled by default, as it will add extra performance cost if it is always enabled.
In the video above, I manually enabled the SkeletonRenderTextureFadeout
component to make it easier to see what is happening, but you can easily get the same effect by simply enabling it from your code.
(When the SkeletonRenderTextureFadeout
is enabled, it enables the SkeletonRenderTexture
attached to the same GameObject.)
Also, at the end of the fadeout, the event delegate OnFadeoutComplete
is called, to which you can bind, for example, a method that disables or destroys the entire GameObject.
The fade in effect should be achieved with only a slight modification to the SkeltonRenderTextureFadeout.cs
. For example, you can change the lines 80 through 82 as follows:
float fadeinAlpha = (fadeinSeconds - fadeinSecondsRemaining) / fadeinSeconds;
#if HAS_VECTOR_INT
skeletonRenderTexture.color.a = fadeinAlpha;
(Assuming that all strings fadeout
in variable names etc. in the script are replaced to fadein
.)