Skip to content

Commit

Permalink
fix: an error happens during loading scene in editor
Browse files Browse the repository at this point in the history
close #101
  • Loading branch information
mob-sakai committed Sep 27, 2020
1 parent bfa1818 commit ab9d9aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Packages/UIParticle/Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,16 @@ private void InitializeIfNeeded()
#if UNITY_EDITOR
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
if (Application.isPlaying) return;
InitializeIfNeeded();
}

void ISerializationCallbackReceiver.OnAfterDeserialize()
{
UnityEditor.EditorApplication.delayCall += () =>
{
if (this) InitializeIfNeeded();
if (Application.isPlaying || !this) return;
InitializeIfNeeded();
};
}
#endif
Expand Down

0 comments on commit ab9d9aa

Please sign in to comment.