[unity] Include Unity 5.6 for clipInfoCache API usage.

This commit is contained in:
John 2018-01-06 21:30:37 +08:00 committed by GitHub
parent 97c5293fb1
commit 5e563c883d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
// Contributed by: Mitch Thompson
#if UNITY_5_6_OR_NEWER
#define UNITY_CLIPINFOCACHE
#endif
using UnityEngine;
using System.Collections.Generic;
@ -116,7 +118,7 @@ namespace Spine.Unity {
readonly Dictionary<int, Spine.Animation> animationTable = new Dictionary<int, Spine.Animation>(IntEqualityComparer.Instance);
readonly Dictionary<AnimationClip, int> clipNameHashCodeTable = new Dictionary<AnimationClip, int>(AnimationClipEqualityComparer.Instance);
readonly List<Animation> previousAnimations = new List<Animation>();
#if UNITY_2017_1_OR_NEWER
#if UNITY_CLIPINFOCACHE
readonly List<AnimatorClipInfo> clipInfoCache = new List<AnimatorClipInfo>();
readonly List<AnimatorClipInfo> nextClipInfoCache = new List<AnimatorClipInfo>();
#endif
@ -135,7 +137,7 @@ namespace Spine.Unity {
animationTable.Add(a.Name.GetHashCode(), a);
clipNameHashCodeTable.Clear();
#if UNITY_2017_1_OR_NEWER
#if UNITY_CLIPINFOCACHE
clipInfoCache.Clear();
nextClipInfoCache.Clear();
#endif
@ -263,7 +265,7 @@ namespace Spine.Unity {
out int nextClipInfoCount,
out IList<AnimatorClipInfo> clipInfo,
out IList<AnimatorClipInfo> nextClipInfo) {
#if UNITY_2017_1_OR_NEWER
#if UNITY_CLIPINFOCACHE
clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer);
nextClipInfoCount = animator.GetNextAnimatorClipInfoCount(layer);
if (clipInfoCache.Capacity < clipInfoCount) clipInfoCache.Capacity = clipInfoCount;