Skip to content

Commit

Permalink
🐛 fix: Setup by Awake on Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
esnya committed Feb 11, 2023
1 parent 48e9721 commit 70a3fb0
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ public override void OnPlayerLeft(VRCPlayerApi player)
}

#if !COMPILER_UDONSHARP && UNITY_EDITOR
private void Awake()
{
Setup();
}

private static IEnumerable<T> GetComponentsInScene<T>(bool includeInActive) where T : UdonSharpBehaviour
{
return SceneManager.GetActiveScene().GetRootGameObjects().SelectMany(o => o.GetComponentsInChildren<T>(includeInActive));
Expand Down Expand Up @@ -406,18 +411,9 @@ private static void SetupAll()
{
Debug.Log($"[{urc.gameObject.name}] Auto setup");
urc.Setup();
UdonSharpEditorUtility.CopyProxyToUdon(urc);
}
}

[InitializeOnLoadMethod]
public static void RegisterCallbacks()
{
EditorApplication.playModeStateChanged += (PlayModeStateChange e) => {
if (e == PlayModeStateChange.EnteredPlayMode) SetupAll();
};
}

public class BuildCallback : Editor, IVRCSDKBuildRequestedCallback
{
public int callbackOrder => 10;
Expand Down

0 comments on commit 70a3fb0

Please sign in to comment.