Created
March 21, 2024 23:37
-
-
Save baba-s/0185f1cb5f4a36f5a7957a081adbc1ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
[InitializeOnLoad] | |
public sealed class Example : EditorWindow | |
{ | |
private BuildPlayerOptions m_buildPlayerOptions; | |
static Example() | |
{ | |
BuildPlayerWindow.RegisterBuildPlayerHandler( OnBuildPlayer ); | |
} | |
private static void OnBuildPlayer( BuildPlayerOptions buildPlayerOptions ) | |
{ | |
var example = GetWindow<Example>(); | |
example.m_buildPlayerOptions = buildPlayerOptions; | |
} | |
private void OnGUI() | |
{ | |
EditorGUILayout.LabelField( "ここに独自のビルド設定用の GUI を表示する" ); | |
var buildOptions = m_buildPlayerOptions.options; | |
var label = ( buildOptions & BuildOptions.AutoRunPlayer ) == 0 | |
? "Build" | |
: "Build And Run" | |
; | |
if ( GUILayout.Button( label ) ) | |
{ | |
BuildPlayerWindow.DefaultBuildMethods.BuildPlayer( m_buildPlayerOptions ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment