From ea745c3f94d8682327c912030dfc6b65cbe1ced5 Mon Sep 17 00:00:00 2001 From: Andreas Stange Date: Fri, 18 Sep 2020 19:31:45 +0200 Subject: [PATCH 1/2] Explicitly reset static fields to make Unity's Domain Reload optional --- Assets/LeanTween/Framework/LeanTween.cs | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Assets/LeanTween/Framework/LeanTween.cs b/Assets/LeanTween/Framework/LeanTween.cs index 8bc23e41..5e84ccf4 100755 --- a/Assets/LeanTween/Framework/LeanTween.cs +++ b/Assets/LeanTween/Framework/LeanTween.cs @@ -271,6 +271,41 @@ public class LeanTween : MonoBehaviour { public static AnimationCurve punch = new AnimationCurve( new Keyframe(0.0f, 0.0f ), new Keyframe(0.112586f, 0.9976035f ), new Keyframe(0.3120486f, -0.1720615f ), new Keyframe(0.4316337f, 0.07030682f ), new Keyframe(0.5524869f, -0.03141804f ), new Keyframe(0.6549395f, 0.003909959f ), new Keyframe(0.770987f, -0.009817753f ), new Keyframe(0.8838775f, 0.001939224f ), new Keyframe(1.0f, 0.0f ) ); public static AnimationCurve shake = new AnimationCurve( new Keyframe(0f, 0f), new Keyframe(0.25f, 1f), new Keyframe(0.75f, -1f), new Keyframe(1f, 0f) ) ; + /** + * Explicitly reset static fields to make Unity's Domain Reload optional. + * See https://docs.unity3d.com/2020.1/Documentation/Manual/DomainReloading.html + */ + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] + static void resetStaticFields(){ + throwErrors = true; + tau = Mathf.PI * 2.0f; + PI_DIV2 = Mathf.PI / 2.0f; + + sequences = null; + + tweens = null; + tweensFinished = null; + tweensFinishedIds = null; + tween = null; + tweenMaxSearch = -1; + maxTweens = 400; + maxSequences = 400; + frameRendered = -1; + _tweenEmpty = null; + dtEstimated = -1f; + dtManual = 0; +#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 + float previousRealTime = 0; +#endif + dtActual = 0; + global_counter = 0; + i = 0; + j = 0; + finishedCnt = 0; + punch = new AnimationCurve(new Keyframe(0.0f, 0.0f), new Keyframe(0.112586f, 0.9976035f), new Keyframe(0.3120486f, -0.1720615f), new Keyframe(0.4316337f, 0.07030682f), new Keyframe(0.5524869f, -0.03141804f), new Keyframe(0.6549395f, 0.003909959f), new Keyframe(0.770987f, -0.009817753f), new Keyframe(0.8838775f, 0.001939224f), new Keyframe(1.0f, 0.0f)); + shake = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.25f, 1f), new Keyframe(0.75f, -1f), new Keyframe(1f, 0f)); + } + public static void init(){ init(maxTweens); } From 7474864575b3f7d339b9620a2a6313d074ab16ef Mon Sep 17 00:00:00 2001 From: achimmihca Date: Fri, 22 Oct 2021 08:18:22 +0200 Subject: [PATCH 2/2] Update Assets/LeanTween/Framework/LeanTween.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kabu Värälä --- Assets/LeanTween/Framework/LeanTween.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/LeanTween/Framework/LeanTween.cs b/Assets/LeanTween/Framework/LeanTween.cs index 5e84ccf4..d76acc3d 100755 --- a/Assets/LeanTween/Framework/LeanTween.cs +++ b/Assets/LeanTween/Framework/LeanTween.cs @@ -295,7 +295,7 @@ static void resetStaticFields(){ dtEstimated = -1f; dtManual = 0; #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 - float previousRealTime = 0; + previousRealTime = 0; #endif dtActual = 0; global_counter = 0;