Эх сурвалжийг харах

[unity] Fixes to some sample scripts.

pharan 8 жил өмнө
parent
commit
1565b40bd3

+ 1 - 1
spine-unity/Assets/Examples/Getting Started/Scripts/SpineboyBeginnerView.cs

@@ -123,7 +123,7 @@ namespace Spine.Unity.Examples {
 		public void PlayShoot () {
 			// Play the shoot animation on track 1.
 			skeletonAnimation.AnimationState.SetAnimation(1, shoot, false);
-			//skeletonAnimation.state.AddEmptyAnimation(1, 0.1f, 0f);
+			skeletonAnimation.AnimationState.AddEmptyAnimation(1, .3f, .3f);
 			gunSource.pitch = GetRandomPitch(gunsoundPitchOffset);
 			gunSource.Play();
 			gunParticles.randomSeed = (uint)Random.Range(0, 100);

+ 2 - 2
spine-unity/Assets/Examples/Scripts/MixAndMatch.cs

@@ -42,7 +42,6 @@ namespace Spine.Unity.Examples {
 		[SpineSlot] public string handSlot;
 		public Vector2 newHandOffset;
 		public float newHandRotation;
-		public Texture2D handTexture;
 
 		[Header("From Sprite")]
 		public Sprite dagger;
@@ -79,7 +78,6 @@ namespace Spine.Unity.Examples {
 			newHand.Rotation = newHandRotation;
 			newHand.UpdateOffset();
 			int handSlotIndex = skeleton.FindSlotIndex(handSlot);
-			handTexture = newHand.GetRegion().ToTexture();
 			newSkin.AddAttachment(handSlotIndex, handAttachmentName, newHand);
 
 			// Case 2: Create an attachment from a Unity Sprite (Sprite texture needs to be Read/Write Enabled in the inspector.
@@ -106,6 +104,8 @@ namespace Spine.Unity.Examples {
 			skeleton.SetSkin(newSkin);
 			skeleton.SetToSetupPose();
 			skeleton.SetAttachment(weaponSlot, daggerName);
+
+			Resources.UnloadUnusedAssets();
 		}
 
 	}

+ 1 - 1
spine-unity/Assets/Examples/Scripts/RaggedySpineboy.cs

@@ -49,7 +49,7 @@ namespace Spine.Unity.Examples {
 
 		void AddRigidbody () {
 			var rb = gameObject.AddComponent<Rigidbody2D>();
-			#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5
+			#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3_OR_NEWER
 	        rb.freezeRotation = true;
 			#else
 			rb.fixedAngle = true;