Skip to content

Instantly share code, notes, and snippets.

@Skyzi000
Last active April 10, 2022 22:11
Show Gist options
  • Save Skyzi000/2d5f728f02c656743af190dd5e50a491 to your computer and use it in GitHub Desktop.
Save Skyzi000/2d5f728f02c656743af190dd5e50a491 to your computer and use it in GitHub Desktop.
SRDebugger LoadSceneOption - BuildSettingsの全てのシーンにワンタップで切り替え
public static class SRDebuggerLoadSceneOption
{
#if !DISABLE_SRDEBUGGER
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void AddLoadSceneOptions()
{
for (var i = 0; i < UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings; i++)
{
var buildIndex = i;
var option = SRDebugger.OptionDefinition.FromMethod(
System.IO.Path.GetFileNameWithoutExtension(UnityEngine.SceneManagement.SceneUtility.GetScenePathByBuildIndex(buildIndex)), () =>
UnityEngine.SceneManagement.SceneManager.LoadScene(buildIndex), "LoadScene");
SRDebug.Instance.AddOption(option);
}
}
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment