ググっても情報が出なかったので、一応メモしておく。
(調査した日は12/18)
◆文字の改行
Inspector上で改行して文字を入力したいとき、
Mac だとAlt + Enterで改行できる。Windowsは知らないけど同じだと思う。
ただし、現状だと直感的ではないのでGUITextを割と使う人はコンポーネントをCustomEditorでカスタマイズしたら良いと思う。
ちなみにスクリプト上なら"\n"で改行。
public void ClassA { #define HELLO_WORLD 0 public int a; public ClassA() { a = 0; } }
public class MenuA { private const string MENUITEMNAME = "MenuB"; [MenuItem(MENUITEMNAME + "/hideALLCameraObjects")] static void hideALLCameraObjects() { GameObject[] objects = (GameObject[]) GameObject.FindSceneObjectsOfType(typeof(GameObject)); foreach(GameObject obj in objects) { if (obj.camera != null && !obj.camera.name.Equals("Main Camera") ) { obj.camera.enabled = false; } } } }
public class PreferencesMenuB { private const string MENUITEMNAME = "MenuB"; private const string TEXT_KEY = "HashKey"; [PreferenceItem (MENUITEMNAME)] public static void PreferencesGUI () { if (!prefsLoaded) { text = EditorPrefs.GetString (TEXT_KEY, ""); prefsLoaded = true; } text = EditorGUILayout.TextArea (text, GUILayout.Height(100)); if (GUI.changed) EditorPrefs.SetString (TEXT_KEY, text); } }
using UnityEngine; using UnityEditor; [CustomEditor(typeof(ClassB))] public class CustomInspectorForClassB : Editor { public override void OnInspectorGUI() { ClassB script = target as ClassB; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Rotate Y Speed"); script.SpeedY = EditorGUILayout.Slider(script.SpeedY, 0, 30); EditorGUILayout.EndHorizontal(); } }
using UnityEngine; using System.Collections; publicclass SampleClass : MonoBehaviour { public virtual void Start() { } public virtual void Update() { } }
using UnityEngine; public class HelloClass : SampleClass { // Use this for initialization public override void Start () { base.Update(); } // Update is called once per frame public override void Update () { base.Update(); } }