[unity] Previous commit did not compile on Unity 2017.1 and earlier, fixed. See #1337.

This commit is contained in:
Harald Csaszar 2022-03-02 22:46:03 +01:00
parent 5e8e4c21f1
commit b8da2fa27b
2 changed files with 14 additions and 0 deletions

View File

@ -27,6 +27,10 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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;
using UnityEngine.Events; using UnityEngine.Events;
@ -43,10 +47,14 @@ namespace Spine.Unity.Examples {
// due to overlapping attachment meshes. // due to overlapping attachment meshes.
normalSkeletonRenderer.Skeleton.SetColor(new Color(1, 1, 1, fadeoutAlpha)); 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 // Thus we render the whole skeleton to a RenderTexture first using the
// SkeletonRenderTexture component. // SkeletonRenderTexture component.
// Changing transparency at a single quad with a RenderTexture works as desired. // Changing transparency at a single quad with a RenderTexture works as desired.
skeletonRenderTexture.color.a = fadeoutAlpha; skeletonRenderTexture.color.a = fadeoutAlpha;
#else
Debug.LogError("The SkeletonRenderTexture component requires Unity 2017.2 or newer.");
#endif
} }
} }
} }

View File

@ -31,6 +31,10 @@
#define HAS_FORCE_RENDER_OFF #define HAS_FORCE_RENDER_OFF
#endif #endif
#if UNITY_2017_2_OR_NEWER
#define HAS_VECTOR_INT
#endif
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering; using UnityEngine.Rendering;
@ -39,6 +43,7 @@ namespace Spine.Unity.Examples {
[RequireComponent(typeof(SkeletonRenderer))] [RequireComponent(typeof(SkeletonRenderer))]
public class SkeletonRenderTexture : MonoBehaviour { public class SkeletonRenderTexture : MonoBehaviour {
#if HAS_VECTOR_INT
public Color color = Color.white; public Color color = Color.white;
public Material quadMaterial; public Material quadMaterial;
public Camera targetCamera; public Camera targetCamera;
@ -230,5 +235,6 @@ namespace Spine.Unity.Examples {
allocatedRenderTextureSize = textureSize; allocatedRenderTextureSize = textureSize;
} }
} }
#endif
} }
} }