From a2ebc12004c05e75b6a1414b4456e8d5c4f1d94e Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 5 Dec 2016 02:17:27 +0700 Subject: [PATCH] update controllers to late update --- .../Scripts/FTRuntime/SwfClipController.cs | 3 +++ .../Scripts/FTRuntime/SwfManager.cs | 27 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Assets/FlashTools/Scripts/FTRuntime/SwfClipController.cs b/Assets/FlashTools/Scripts/FTRuntime/SwfClipController.cs index 28b52e2..c779015 100644 --- a/Assets/FlashTools/Scripts/FTRuntime/SwfClipController.cs +++ b/Assets/FlashTools/Scripts/FTRuntime/SwfClipController.cs @@ -349,6 +349,9 @@ namespace FTRuntime { void Awake() { _clip = GetComponent(); + } + + void Start() { if ( autoPlay && Application.isPlaying ) { Play(false); } diff --git a/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs b/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs index 841d537..63a635f 100644 --- a/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs +++ b/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs @@ -223,7 +223,16 @@ namespace FTRuntime { _controllers.Clear(); } - void UpdateControllers(float dt) { + void LateUpdateClips() { + for ( int i = 0, e = _clips.Count; i < e; ++i ) { + var clip = _clips[i]; + if ( clip ) { + clip.Internal_LateUpdate(); + } + } + } + + void LateUpdateControllers(float dt) { _controllers.AssignTo(_safeUpdates); for ( int i = 0, e = _safeUpdates.Count; i < e; ++i ) { var ctrl = _safeUpdates[i]; @@ -240,15 +249,6 @@ namespace FTRuntime { _safeUpdates.Clear(); } - void LateUpdateClips() { - for ( int i = 0, e = _clips.Count; i < e; ++i ) { - var clip = _clips[i]; - if ( clip ) { - clip.Internal_LateUpdate(); - } - } - } - // --------------------------------------------------------------------- // // Messages @@ -265,14 +265,11 @@ namespace FTRuntime { DropControllers(); } - void Update() { + void LateUpdate() { if ( isPlaying ) { var dt = Time.deltaTime; - UpdateControllers(rateScale * dt); + LateUpdateControllers(rateScale * dt); } - } - - void LateUpdate() { LateUpdateClips(); } }