Skip to content

Commit

Permalink
🐛 fix(multi-text-loader): Do not destroy on editor
Browse files Browse the repository at this point in the history
  • Loading branch information
esnya committed Feb 7, 2023
1 parent 46cedde commit 87c7e79
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class MultiTextLoader : MonoBehaviour
#if UNITY_EDITOR
private void Start()
{
Load();
Load(false);
}

private void Load()
private void Load(bool destroy)
{
var textAssets = AssetDatabase
.FindAssets("t:TextAsset", new [] { textPath })
Expand All @@ -35,14 +35,14 @@ private void Load()
tmp.text = textAssets[name].text;
}

DestroyImmediate(this);
if (destroy) DestroyImmediate(this);
}

private static void LoadAllInScene()
private static void LoadAllInScene(bool destroy)
{
foreach (var o in FindObjectsOfType(typeof(MultiTextLoader)))
{
(o as MultiTextLoader)?.Load();
(o as MultiTextLoader)?.Load(destroy);
}
}

Expand All @@ -53,7 +53,7 @@ public class BuildCallback : Editor, IVRCSDKBuildRequestedCallback

public bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
{
LoadAllInScene();
LoadAllInScene(true);
return true;
}
}
Expand Down

0 comments on commit 87c7e79

Please sign in to comment.