mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fix Unity 4 compile errors
Added preprocessors to allow Spine to compile in Unity 4
This commit is contained in:
parent
1e7f6277c2
commit
30b36b6423
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
public static class SpineMesh {
|
public static class SpineMesh {
|
||||||
|
#if UNITY_5
|
||||||
internal const HideFlags MeshHideflags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;
|
internal const HideFlags MeshHideflags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;
|
||||||
|
#else
|
||||||
|
internal const HideFlags MeshHideflags = HideFlags.DontSave;
|
||||||
|
#endif
|
||||||
/// <summary>Factory method for creating a new mesh for use in Spine components. This can be called in field initializers.</summary>
|
/// <summary>Factory method for creating a new mesh for use in Spine components. This can be called in field initializers.</summary>
|
||||||
public static Mesh NewMesh () {
|
public static Mesh NewMesh () {
|
||||||
var m = new Mesh();
|
var m = new Mesh();
|
||||||
|
|||||||
@ -111,8 +111,11 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
float time = stateInfo.normalizedTime * info.clip.length;
|
float time = stateInfo.normalizedTime * info.clip.length;
|
||||||
animationTable[GetAnimationClipNameHashCode(info.clip)].Mix(skeleton, Mathf.Max(0, time - deltaTime), time, stateInfo.loop, null, weight);
|
animationTable[GetAnimationClipNameHashCode(info.clip)].Mix(skeleton, Mathf.Max(0, time - deltaTime), time, stateInfo.loop, null, weight);
|
||||||
}
|
}
|
||||||
|
#if UNITY_5
|
||||||
if (nextStateInfo.fullPathHash != 0) {
|
if (nextStateInfo.fullPathHash != 0) {
|
||||||
|
#else
|
||||||
|
if (nextStateInfo.nameHash != 0) {
|
||||||
|
#endif
|
||||||
for (int c = 0; c < nextClipInfo.Length; c++) {
|
for (int c = 0; c < nextClipInfo.Length; c++) {
|
||||||
var info = nextClipInfo[c];
|
var info = nextClipInfo[c];
|
||||||
float weight = info.weight * layerWeight;
|
float weight = info.weight * layerWeight;
|
||||||
@ -150,8 +153,11 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
|
#if UNITY_5
|
||||||
if (nextStateInfo.fullPathHash != 0) {
|
if (nextStateInfo.fullPathHash != 0) {
|
||||||
|
#else
|
||||||
|
if (nextStateInfo.nameHash != 0) {
|
||||||
|
#endif
|
||||||
//apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
|
//apply next clip directly instead of mixing (ie: no crossfade, ignores mecanim transition weights)
|
||||||
if (mode == MixMode.SpineStyle) {
|
if (mode == MixMode.SpineStyle) {
|
||||||
for (; c < nextClipInfo.Length; c++) {
|
for (; c < nextClipInfo.Length; c++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user