From 153a1cbb8515de6a78c09e9320ebf576ada77026 Mon Sep 17 00:00:00 2001 From: Konstantin Gindemit Date: Sun, 26 Nov 2023 09:58:41 +0100 Subject: [PATCH] ~ Removed unnecessary checks for the json file format when loading lottie animation. --- .../Assets/LottiePlugin/Editor/src/AnimatedButtonEditor.cs | 6 ++---- .../Assets/LottiePlugin/Editor/src/AnimatedImageEditor.cs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedButtonEditor.cs b/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedButtonEditor.cs index 0f28303..3d5a312 100644 --- a/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedButtonEditor.cs +++ b/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedButtonEditor.cs @@ -91,8 +91,7 @@ public override void OnInspectorGUI() SetStateValuesAtIndex(1, "End", _lottieAnimation != null ? (int)_lottieAnimation.TotalFramesCount : 0, true); } if (_button.AnimationJson == null || - string.IsNullOrEmpty(_button.AnimationJson.text) || - !_button.AnimationJson.text.StartsWith("{\"v\":")) + string.IsNullOrEmpty(_button.AnimationJson.text)) { EditorGUILayout.HelpBox("You must have a lottie json in order to use the animated button.", MessageType.Error); } @@ -159,8 +158,7 @@ private void CreateAnimationIfNecessaryAndAttachToGraphic() return; } string jsonData = _button.AnimationJson.text; - if (string.IsNullOrEmpty(jsonData) || - !jsonData.StartsWith("{\"v\":")) + if (string.IsNullOrEmpty(jsonData)) { Debug.LogError("Selected file is not a lottie json"); return; diff --git a/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedImageEditor.cs b/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedImageEditor.cs index 131c246..d608683 100644 --- a/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedImageEditor.cs +++ b/unity/RLottieUnity/Assets/LottiePlugin/Editor/src/AnimatedImageEditor.cs @@ -48,8 +48,7 @@ public override void OnInspectorGUI() UpdateTheAnimationInfoBoxText(); } if (_image.AnimationJson == null || - string.IsNullOrEmpty(_image.AnimationJson.text) || - !_image.AnimationJson.text.StartsWith("{\"v\":")) + string.IsNullOrEmpty(_image.AnimationJson.text)) { EditorGUILayout.HelpBox("You must have a lottie json in order to use the animated image.", MessageType.Error); } @@ -103,8 +102,7 @@ private void CreateAnimationIfNecessaryAndAttachToGraphic() return; } string jsonData = _image.AnimationJson.text; - if (string.IsNullOrEmpty(jsonData) || - !jsonData.StartsWith("{\"v\":")) + if (string.IsNullOrEmpty(jsonData)) { Debug.LogError("Selected file is not a lottie json"); return;