From e6acc6725b79a1245629acac55ade5b497e18be9 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sat, 15 Dec 2018 22:41:04 +0100 Subject: [PATCH 1/6] [libgdx] Fixed path constraint computations being invalid if a path's length is ever NaN. --- .../src/com/esotericsoftware/spine/PathConstraint.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java index e759d75e3..4901f4522 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/PathConstraint.java @@ -208,7 +208,7 @@ public class PathConstraint implements Constraint { float pathLength = lengths[curveCount]; if (percentPosition) position *= pathLength; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spaces[i] *= pathLength; } world = this.world.setSize(8); @@ -319,7 +319,7 @@ public class PathConstraint implements Constraint { else position *= pathLength / path.getLengths()[curveCount - 1]; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spaces[i] *= pathLength; } From 258215ec06f17545f230f3af85c7548b13e6a369 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Sat, 15 Dec 2018 22:56:41 +0100 Subject: [PATCH 2/6] [csharp] Fixed path constraint computations being invalid if a path's length is ever NaN. See #1230 --- spine-csharp/src/PathConstraint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-csharp/src/PathConstraint.cs b/spine-csharp/src/PathConstraint.cs index c0bc699ab..51f202c94 100644 --- a/spine-csharp/src/PathConstraint.cs +++ b/spine-csharp/src/PathConstraint.cs @@ -191,7 +191,7 @@ namespace Spine { pathLength = lengths[curveCount]; if (percentPosition) position *= pathLength; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spacesItems[i] *= pathLength; } world = this.world.Resize(8).Items; @@ -303,7 +303,7 @@ namespace Spine { position *= pathLength / path.lengths[curveCount - 1]; if (percentSpacing) { - for (int i = 0; i < spacesCount; i++) + for (int i = 1; i < spacesCount; i++) spacesItems[i] *= pathLength; } From 8c47b66dc0c6ea3ddcc2b886aeb26ca624b1f069 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Sat, 15 Dec 2018 22:02:18 +0100 Subject: [PATCH 3/6] [csharp] Added missing default initialization of scaleX and scaleY parameters which caused incorrectly placed bones with PathConstraints in some cases. Fixes #1222 (cherry picked from commit 651416c620f13beb4ecf98de0a62c1466bc2afaf) --- spine-csharp/src/Skeleton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-csharp/src/Skeleton.cs b/spine-csharp/src/Skeleton.cs index 70f776c39..601fb71ff 100644 --- a/spine-csharp/src/Skeleton.cs +++ b/spine-csharp/src/Skeleton.cs @@ -45,7 +45,7 @@ namespace Spine { internal Skin skin; internal float r = 1, g = 1, b = 1, a = 1; internal float time; - internal float scaleX, scaleY; + internal float scaleX = 1, scaleY = 1; internal float x, y; public SkeletonData Data { get { return data; } } From 43f31bd6752ef79b202fab80cce823d16095d903 Mon Sep 17 00:00:00 2001 From: pharan Date: Mon, 17 Dec 2018 16:08:51 +0800 Subject: [PATCH 4/6] [unity] Update example materials. --- .../Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat | 1 + .../Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat | 1 + .../Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat | 1 + .../Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat | 1 + .../Spine Skeletons/FootSoldier/FS_White_Material.mat | 1 + .../Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat | 1 + .../Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat | 1 + .../Raggedy Spineboy/Raggedy Spineboy_Material.mat | 1 + .../Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat | 1 + .../Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat | 1 + .../Spine Skeletons/spineboy-unity/spineboy_Material.mat | 1 + 11 files changed, 11 insertions(+) diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat index afe2ac7f2..367d88d06 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat index 53e0ab476..0694b83dd 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Dragon/dragon_dragon2.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat index 3bd4acb92..8e3913b56 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Eyes/eyes_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat index 4f13dcbab..1588749c2 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/Equipment/Equipment_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat index 10a8e03e6..498848cc8 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/FootSoldier/FS_White_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat index 2649ff10d..7cccdb634 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Gauge/Gauge_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat index 49dcc1e07..76ee21f4d 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Goblins/goblins_Material.mat @@ -24,6 +24,7 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: - _Black: {r: 1, g: 0, b: 0, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat index 062647744..18c584648 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raggedy Spineboy/Raggedy Spineboy_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat index 418a14f81..b291eb89b 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/Raptor/raptor_Material.mat @@ -24,6 +24,7 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: - _Black: {r: 0, g: 0, b: 0, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat index 9d639058a..0a9ccec76 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-pro/spineboy-pro_Material.mat @@ -24,4 +24,5 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _Cutoff: 0.1 + - _StraightAlphaInput: 0 m_Colors: [] diff --git a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat index 89ba93e92..245d684e9 100644 --- a/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat +++ b/spine-unity/Assets/Spine Examples/Spine Skeletons/spineboy-unity/spineboy_Material.mat @@ -28,6 +28,7 @@ Material: - _Cutoff: 0.1 - _FillPhase: 0 - _RefractionStrength: 0.01 + - _StraightAlphaInput: 0 - _node_3476: 0 m_Colors: - _Black: {r: 0, g: 0, b: 0, a: 0} From 9a7f6add4b14dc4351537fca534112e6bddde4b1 Mon Sep 17 00:00:00 2001 From: pharan Date: Mon, 17 Dec 2018 16:09:42 +0800 Subject: [PATCH 5/6] [unity] Frame limit example component and scene. --- .../Other Examples/FixedTimestepUpdates.unity | 716 ++++++++++++++++++ .../FixedTimestepUpdates.unity.meta | 8 + .../SkeletonAnimationFixedTimestep.cs | 93 +++ .../SkeletonAnimationFixedTimestep.cs.meta | 12 + 4 files changed, 829 insertions(+) create mode 100644 spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity create mode 100644 spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta diff --git a/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity new file mode 100644 index 000000000..ba1cadb69 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity @@ -0,0 +1,716 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 8 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 3 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 + m_LightingDataAsset: {fileID: 0} + m_ShadowMaskMode: 2 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &466319114 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 466319119} + - component: {fileID: 466319118} + - component: {fileID: 466319117} + - component: {fileID: 466319116} + - component: {fileID: 466319115} + m_Layer: 0 + m_Name: spineboy limited - 2/60 offset + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &466319115 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1670ee04b19c794db301d734c71bdd6, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonAnimation: {fileID: 466319116} + frameDeltaTime: 0.083333336 + maxFrameSkip: 2 + frameskipMeshUpdate: 1 + timeOffset: 0.033333335 +--- !u!114 &466319116 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + initialFlipX: 0 + initialFlipY: 0 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + addNormals: 0 + calculateTangents: 0 + disableRenderingOnOverride: 1 + _animationName: walk + loop: 1 + timeScale: 1 +--- !u!23 &466319117 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 2 +--- !u!33 &466319118 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_Mesh: {fileID: 0} +--- !u!4 &466319119 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466319114} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -6.71, y: -4.62, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &706647559 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 706647560} + - component: {fileID: 706647562} + - component: {fileID: 706647561} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &706647560 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 706647559} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 767959873} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -411} + m_SizeDelta: {x: 969, y: 93} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &706647561 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 706647559} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: The Spineboys on the left use SkeletonAnimationFixedTimestep to limit their + update rate. +--- !u!222 &706647562 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 706647559} +--- !u!1 &767959869 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 767959873} + - component: {fileID: 767959872} + - component: {fileID: 767959871} + - component: {fileID: 767959870} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &767959870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &767959871 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &767959872 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &767959873 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 767959869} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 706647560} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1140995461 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1140995465} + - component: {fileID: 1140995464} + - component: {fileID: 1140995463} + - component: {fileID: 1140995462} + - component: {fileID: 1140995466} + m_Layer: 0 + m_Name: spineboy limited + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1140995462 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + initialFlipX: 0 + initialFlipY: 0 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + addNormals: 0 + calculateTangents: 0 + disableRenderingOnOverride: 1 + _animationName: walk + loop: 1 + timeScale: 1 +--- !u!23 &1140995463 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1140995464 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Mesh: {fileID: 0} +--- !u!4 &1140995465 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -3.75, y: -3.0900269, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1140995466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1140995461} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1670ee04b19c794db301d734c71bdd6, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonAnimation: {fileID: 1140995462} + frameDeltaTime: 0.083333336 + maxFrameSkip: 2 + frameskipMeshUpdate: 1 + timeOffset: 0 +--- !u!1 &1660595237 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1660595242} + - component: {fileID: 1660595241} + - component: {fileID: 1660595240} + - component: {fileID: 1660595239} + - component: {fileID: 1660595238} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1660595238 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 +--- !u!124 &1660595239 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 +--- !u!92 &1660595240 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 +--- !u!20 &1660595241 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.56779844, g: 0.6221558, b: 0.6544118, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &1660595242 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1660595237} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1915670692 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1915670697} + - component: {fileID: 1915670696} + - component: {fileID: 1915670695} + - component: {fileID: 1915670694} + - component: {fileID: 1915670693} + m_Layer: 0 + m_Name: spineboy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1915670693 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1670ee04b19c794db301d734c71bdd6, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonAnimation: {fileID: 1915670694} + frameDeltaTime: 0.041666668 + maxFrameSkip: 2 + frameskipMeshUpdate: 1 + timeOffset: 0 +--- !u!114 &1915670694 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + initialFlipX: 0 + initialFlipY: 0 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + addNormals: 0 + calculateTangents: 0 + disableRenderingOnOverride: 1 + _animationName: walk + loop: 1 + timeScale: 1 +--- !u!23 &1915670695 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1915670696 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_Mesh: {fileID: 0} +--- !u!4 &1915670697 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1915670692} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 2.68, y: -3.09, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta new file mode 100644 index 000000000..1ccc74bbd --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Other Examples/FixedTimestepUpdates.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48557e58ca94ae740bdbcf7cca4f1cb3 +timeCreated: 1545032603 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs new file mode 100644 index 000000000..9759fe46e --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs @@ -0,0 +1,93 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ +using UnityEngine; + +namespace Spine.Unity { + [DisallowMultipleComponent] + public sealed class SkeletonAnimationFixedTimestep : MonoBehaviour { + #region Inspector + public SkeletonAnimation skeletonAnimation; + + [Tooltip("The duration of each frame in seconds. For 12fps: enter '1/12' in the Unity inspector.")] + public float frameDeltaTime = 1 / 15f; + + [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.")] + 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.")] + 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.")] + public float timeOffset; + #endregion + + float accumulatedTime = 0; + bool requiresNewMesh; + + void OnValidate () { + skeletonAnimation = GetComponent(); + if (frameDeltaTime <= 0) frameDeltaTime = 1 / 60f; + if (maxFrameSkip <= 1) maxFrameSkip = 1; + } + + void Awake () { + requiresNewMesh = true; + accumulatedTime = timeOffset; + } + + void Update () { + if (skeletonAnimation.enabled) + skeletonAnimation.enabled = false; + + accumulatedTime += Time.deltaTime; + + float frames = 0; + while (accumulatedTime >= frameDeltaTime) { + frames++; + if (frames > maxFrameSkip) break; + accumulatedTime -= frameDeltaTime; + } + + if (frames > 0) { + skeletonAnimation.Update(frames * frameDeltaTime); + requiresNewMesh = true; + } + } + + void LateUpdate () { + if (frameskipMeshUpdate && !requiresNewMesh) return; + + skeletonAnimation.LateUpdate(); + requiresNewMesh = false; + } + } +} + diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta new file mode 100644 index 000000000..f437d4cfd --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e1670ee04b19c794db301d734c71bdd6 +timeCreated: 1545031871 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 55f4a2968bacb019d1945ded23fa907649508db0 Mon Sep 17 00:00:00 2001 From: pharan Date: Mon, 17 Dec 2018 16:17:40 +0800 Subject: [PATCH 6/6] [unity] Some fixes and docs for frame limit example. --- .../SkeletonAnimationFixedTimestep.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs index 9759fe46e..65d8b4b3a 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonAnimationFixedTimestep.cs @@ -1,4 +1,4 @@ -/****************************************************************************** +/****************************************************************************** * Spine Runtimes Software License v2.5 * * Copyright (c) 2013-2016, Esoteric Software @@ -30,19 +30,23 @@ using UnityEngine; 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] public sealed class SkeletonAnimationFixedTimestep : MonoBehaviour { #region Inspector 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; [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.")] 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; [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 () { skeletonAnimation = GetComponent(); if (frameDeltaTime <= 0) frameDeltaTime = 1 / 60f; - if (maxFrameSkip <= 1) maxFrameSkip = 1; + if (maxFrameSkip < 1) maxFrameSkip = 1; } void Awake () {