mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] Previous commit did not compile on Unity 2017.1 and earlier, fixed. See #1337.
This commit is contained in:
parent
5e8e4c21f1
commit
b8da2fa27b
@ -27,6 +27,10 @@
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
#define HAS_VECTOR_INT
|
||||
#endif
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
@ -43,10 +47,14 @@ namespace Spine.Unity.Examples {
|
||||
// due to overlapping attachment meshes.
|
||||
normalSkeletonRenderer.Skeleton.SetColor(new Color(1, 1, 1, fadeoutAlpha));
|
||||
|
||||
#if HAS_VECTOR_INT
|
||||
// Thus we render the whole skeleton to a RenderTexture first using the
|
||||
// SkeletonRenderTexture component.
|
||||
// Changing transparency at a single quad with a RenderTexture works as desired.
|
||||
skeletonRenderTexture.color.a = fadeoutAlpha;
|
||||
#else
|
||||
Debug.LogError("The SkeletonRenderTexture component requires Unity 2017.2 or newer.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,10 @@
|
||||
#define HAS_FORCE_RENDER_OFF
|
||||
#endif
|
||||
|
||||
#if UNITY_2017_2_OR_NEWER
|
||||
#define HAS_VECTOR_INT
|
||||
#endif
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
@ -39,6 +43,7 @@ namespace Spine.Unity.Examples {
|
||||
|
||||
[RequireComponent(typeof(SkeletonRenderer))]
|
||||
public class SkeletonRenderTexture : MonoBehaviour {
|
||||
#if HAS_VECTOR_INT
|
||||
public Color color = Color.white;
|
||||
public Material quadMaterial;
|
||||
public Camera targetCamera;
|
||||
@ -230,5 +235,6 @@ namespace Spine.Unity.Examples {
|
||||
allocatedRenderTextureSize = textureSize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user