Skip to content

Instantly share code, notes, and snippets.

@rainbow23
Created January 21, 2015 15:20
Show Gist options
  • Save rainbow23/5f400bf38da6fa9aa220 to your computer and use it in GitHub Desktop.
Save rainbow23/5f400bf38da6fa9aa220 to your computer and use it in GitHub Desktop.
EditorScript : FunctionManagerのメソッドを一つだけ選ぶ仕組み。
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
[CustomEditor(typeof(FunctionManager))]
[CanEditMultipleObjects]
public class FunctionManagerEditor : Editor {
public override void OnInspectorGUI() {
//Debug.Log("OnInspectorGUI");
//DrawDefaultInspector();
FunctionManager obj = target as FunctionManager;
obj.funcType = (FunctionManager.FuncType)EditorGUILayout.EnumPopup( "FuncType", obj.funcType );
if(obj.funcType == FunctionManager.FuncType.HelpFunc)
{
//EditorGUILayout.BeginHorizontal(); // arrange value in the horizontal
obj.helpGameObj = (GameObject)EditorGUILayout.ObjectField( "Help Obj", obj.helpGameObj, typeof( GameObject ), true );
obj.showHelp = EditorGUILayout.Toggle("Show/Hide", obj.showHelp);
//EditorGUILayout.EndHorizontal();
}
EditorUtility.SetDirty(obj);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment