Last active
August 29, 2015 14:02
-
-
Save masayuki5160/ea85a5d4471817c7bc62 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 UnityEngine; | |
using UnityEditor;// これ追加するのわすれないように | |
using System.Collections; | |
public class testScript : EditorWindow {//EditorWindowを継承する | |
[MenuItem("Window/My Window %i")]// 実は%iのとこでショートカットキー指定してたり..なくてもいいよ. | |
static void Init(){ | |
// windowつくれ、ていうことか. | |
testScript window = (testScript)EditorWindow.GetWindow(typeof(testScript)); | |
} | |
bool isEditable; | |
bool childToggleBool = true; | |
float childSliderFloat = 2.22f; | |
void OnGUI(){ | |
GUILayout.Label("DispTest", EditorStyles.boldLabel); | |
int sw = Screen.width; | |
int sh = Screen.height; | |
// トグルでグループ化はじめ. | |
isEditable = EditorGUILayout.BeginToggleGroup("ToggleGroupTest", isEditable); | |
childToggleBool = EditorGUILayout.Toggle("childToggle", childToggleBool);// 子供のトグルグループ | |
childSliderFloat = EditorGUILayout.Slider("childSlider", childSliderFloat, -10, 10);// スライダー | |
EditorGUILayout.EndToggleGroup();// ここまででトグルのon/offグループ化をおわる. | |
} | |
} |
あと注意するのは, Editorというフォルダ配下につくること.
どこでもいいけどね。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考->http://motogeneralpurpose.blogspot.jp/2013/05/unity.html