|
@@ -1,4 +1,4 @@
|
|
-/******************************************************************************
|
|
|
|
|
|
+/******************************************************************************
|
|
* Spine Runtimes Software License v2.5
|
|
* Spine Runtimes Software License v2.5
|
|
*
|
|
*
|
|
* Copyright (c) 2013-2016, Esoteric Software
|
|
* Copyright (c) 2013-2016, Esoteric Software
|
|
@@ -30,19 +30,23 @@
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Spine.Unity {
|
|
namespace Spine.Unity {
|
|
|
|
+
|
|
|
|
+ // To use this example component, add it to your SkeletonAnimation Spine GameObject.
|
|
|
|
+ // This component will disable that SkeletonAnimation component to prevent it from calling its own Update and LateUpdate methods.
|
|
|
|
+
|
|
[DisallowMultipleComponent]
|
|
[DisallowMultipleComponent]
|
|
public sealed class SkeletonAnimationFixedTimestep : MonoBehaviour {
|
|
public sealed class SkeletonAnimationFixedTimestep : MonoBehaviour {
|
|
#region Inspector
|
|
#region Inspector
|
|
public SkeletonAnimation skeletonAnimation;
|
|
public SkeletonAnimation skeletonAnimation;
|
|
|
|
|
|
- [Tooltip("The duration of each frame in seconds. For 12fps: enter '1/12' in the Unity inspector.")]
|
|
|
|
|
|
+ [Tooltip("The duration of each frame in seconds. For 12 fps: enter '1/12' in the Unity inspector.")]
|
|
public float frameDeltaTime = 1 / 15f;
|
|
public float frameDeltaTime = 1 / 15f;
|
|
|
|
|
|
[Header("Advanced")]
|
|
[Header("Advanced")]
|
|
[Tooltip("The maximum number of fixed timesteps. If the game framerate drops below the If the framerate is consistently faster than the limited frames, this does nothing.")]
|
|
[Tooltip("The maximum number of fixed timesteps. If the game framerate drops below the If the framerate is consistently faster than the limited frames, this does nothing.")]
|
|
public int maxFrameSkip = 4;
|
|
public int maxFrameSkip = 4;
|
|
|
|
|
|
- [Tooltip("If enabled, the Skeleton mesh will be updated only on the same frame when the animation is updated./n/nDisable this or call SkeletonAnimation.LateUpdate yourself if you are modifying the Skeleton using other components that don't run in the same fixed timestep.")]
|
|
|
|
|
|
+ [Tooltip("If enabled, the Skeleton mesh will be updated only on the same frame when the animation and skeleton are updated. Disable this or call SkeletonAnimation.LateUpdate yourself if you are modifying the Skeleton using other components that don't run in the same fixed timestep.")]
|
|
public bool frameskipMeshUpdate = true;
|
|
public bool frameskipMeshUpdate = true;
|
|
|
|
|
|
[Tooltip("This is the amount the internal accumulator starts with. Set it to some fraction of your frame delta time if you want to stagger updates between multiple skeletons.")]
|
|
[Tooltip("This is the amount the internal accumulator starts with. Set it to some fraction of your frame delta time if you want to stagger updates between multiple skeletons.")]
|
|
@@ -55,7 +59,7 @@ namespace Spine.Unity {
|
|
void OnValidate () {
|
|
void OnValidate () {
|
|
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
|
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
|
if (frameDeltaTime <= 0) frameDeltaTime = 1 / 60f;
|
|
if (frameDeltaTime <= 0) frameDeltaTime = 1 / 60f;
|
|
- if (maxFrameSkip <= 1) maxFrameSkip = 1;
|
|
|
|
|
|
+ if (maxFrameSkip < 1) maxFrameSkip = 1;
|
|
}
|
|
}
|
|
|
|
|
|
void Awake () {
|
|
void Awake () {
|