From 1565b40bd34b1a5a18d1b89a48b2a719784fb52a Mon Sep 17 00:00:00 2001 From: pharan Date: Sun, 7 May 2017 02:56:37 +0800 Subject: [PATCH] [unity] Fixes to some sample scripts. --- .../Examples/Getting Started/Scripts/SpineboyBeginnerView.cs | 2 +- spine-unity/Assets/Examples/Scripts/MixAndMatch.cs | 4 ++-- spine-unity/Assets/Examples/Scripts/RaggedySpineboy.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Examples/Getting Started/Scripts/SpineboyBeginnerView.cs b/spine-unity/Assets/Examples/Getting Started/Scripts/SpineboyBeginnerView.cs index e5a711123..89fbb0b4d 100644 --- a/spine-unity/Assets/Examples/Getting Started/Scripts/SpineboyBeginnerView.cs +++ b/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); diff --git a/spine-unity/Assets/Examples/Scripts/MixAndMatch.cs b/spine-unity/Assets/Examples/Scripts/MixAndMatch.cs index 35dd08d9a..9c062fa9b 100644 --- a/spine-unity/Assets/Examples/Scripts/MixAndMatch.cs +++ b/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(); } } diff --git a/spine-unity/Assets/Examples/Scripts/RaggedySpineboy.cs b/spine-unity/Assets/Examples/Scripts/RaggedySpineboy.cs index ceded486c..d1f39b98e 100644 --- a/spine-unity/Assets/Examples/Scripts/RaggedySpineboy.cs +++ b/spine-unity/Assets/Examples/Scripts/RaggedySpineboy.cs @@ -49,7 +49,7 @@ namespace Spine.Unity.Examples { void AddRigidbody () { var rb = gameObject.AddComponent(); - #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;