Explorar o código

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

Harald Csaszar %!s(int64=3) %!d(string=hai) anos
pai
achega
b8da2fa27b

+ 8 - 0
spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs

@@ -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
 		}
 	}
 }

+ 6 - 0
spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs

@@ -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
 	}
 }