Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Last active August 29, 2015 14:02
Show Gist options
  • Save masayuki5160/ea85a5d4471817c7bc62 to your computer and use it in GitHub Desktop.
Save masayuki5160/ea85a5d4471817c7bc62 to your computer and use it in GitHub Desktop.
はじめてのエディタースクリプト
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グループ化をおわる.
}
}
@masayuki5160
Copy link
Author

@masayuki5160
Copy link
Author

あと注意するのは, Editorというフォルダ配下につくること.
どこでもいいけどね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment