From 55f4a2968bacb019d1945ded23fa907649508db0 Mon Sep 17 00:00:00 2001 From: pharan Date: Mon, 17 Dec 2018 16:17:40 +0800 Subject: [PATCH] [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 () {