Skip to content

Commit

Permalink
~ Removed unnecessary checks for the json file format when loading lo…
Browse files Browse the repository at this point in the history
…ttie animation.
  • Loading branch information
gindemit committed Nov 26, 2023
1 parent d121bff commit 153a1cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 153a1cb

Please sign in to comment.