Disposable helper class for managing BeginHorizontal / EndHorizontal.

Inheritance: UnityEngine.GUI.Scope
    public override void OnInspectorGUI()
    {
        serializedObject.Update ();

        PrefabLoader loader = target as PrefabLoader;

        PrefabType prefabType = PrefabUtility.GetPrefabType (loader.gameObject);

        if (prefabType == PrefabType.PrefabInstance) {
            GUILayout.Label ("Prefabの管理 (更新/復元はこのボタンで必ずすること)");
            using (var scopeH = new GUILayout.HorizontalScope ()) {
                if (GUILayout.Button ("Select", EditorStyles.miniButtonLeft)) {
                    loader.EditorExecSelect ();
                }
                if (GUILayout.Button ("Revert", EditorStyles.miniButtonMid)) {
                    loader.EditorExecRevert ();
                }
                if (GUILayout.Button ("Apply", EditorStyles.miniButtonRight)) {
                    loader.EditorExecApply ();
                    loader.EditorExecInstantiate ();
                }
            }
        }
        if (prefabType != PrefabType.Prefab) {
            using (var scopeH = new GUILayout.HorizontalScope ()) {
                if (GUILayout.Button ("Instantiate", EditorStyles.miniButtonLeft)) {
                    loader.EditorExecInstantiate ();
                }
                if (GUILayout.Button ("Update TransformData", EditorStyles.miniButtonMid)) {
                    loader.EditorExecUpdateTransformData ();
                }
                if (GUILayout.Button ("Remove", EditorStyles.miniButtonRight)) {
                    loader.EditorExecRemove ();
                }
            }
        }

        if (loader.IsNeedUpdateTransformData() && !Application.isPlaying) {
            EditorGUILayout.HelpBox (
                "子プレハブのTransform情報がシリアライズされていません\n" +
                "Update TransformDataで更新してください."
                , MessageType.Info);
        }

        GUILayout.Space (5f);

        EditorGUILayout.PropertyField (loadTiming, true);

        reorderableList.DoLayoutList ();

        serializedObject.ApplyModifiedProperties();
        //EditorGUILayout.PropertyField (info, true);
    }
 void OnGUI()
 {
     using (var horizonal = new GUILayout.HorizontalScope()) {
         if( GUILayout.Button("+")){ 	controller.IntParameter += 1;	}
         if( GUILayout.Button("-")){ 	controller.IntParameter -= 1;	}
     }
     using (var horizonal = new GUILayout.HorizontalScope()) {
         if( GUILayout.Button("+")){ 	controller.FloatParameter += 0.1f;	}
         if( GUILayout.Button("-")){ 	controller.FloatParameter -= 0.1f;	}
     }
     controller.BoolParameter = GUILayout.Toggle( controller.BoolParameter, controller.BoolParameter.ToString());
     if( GUILayout.Button("trigger")){	controller.Trigger();	}
     using (var horizonal = new GUILayout.HorizontalScope()) {
         if(GUILayout.Button("Move State1") ){	controller.animator.Play( SampleController.State1_State1 );	}
         if(GUILayout.Button("Move State2") ){	controller.animator.Play( SampleController.State1_State2 );	}
     }
 }
Example #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();


        EditorGUI.indentLevel = 0;
        EditorGUILayout.LabelField(new GUIContent("Pop object on hit."));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("defaultPopObjectPrefab"), GUIContent.none);

        EditorGUI.indentLevel = 1;

        list.DoLayoutList();

        EditorGUI.indentLevel = 0;

        using (var scope = new GUILayout.HorizontalScope())
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("enableReflectionMax"), new GUIContent("Reflection limitation"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("reflectionMax"), GUIContent.none);
        }

        EditorGUILayout.PropertyField(serializedObject.FindProperty("lengthMax"), new GUIContent("length"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("force"), new GUIContent("force"));

        EzBeam beam = serializedObject.targetObject as EzBeam;
        IEzBeamRenderer renderer = beam.gameObject.GetComponent<IEzBeamRenderer>();
        if( null == renderer )
        {
            EditorGUILayout.BeginVertical();

            GUILayout.Space(20);
            EditorGUILayout.LabelField("Select EzBeam Renderer");
            string[] options = new string[typeList.Count];
            for (int i = 0; i < typeList.Count; ++i )
            {
                options[i] = typeList[i].Name;
            }
            popupIndex = EditorGUILayout.Popup(popupIndex, options);

            GUILayout.Space(10);

            using (var scope = new BackgroundColorScope(addRendererButtonColor))
            {
                if (GUILayout.Button("Add Renderer") )
                {
                    beam.gameObject.AddComponent(typeList[popupIndex]);
                }
            }



            EditorGUILayout.EndVertical();

        }

        serializedObject.ApplyModifiedProperties();
    }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.GUILayout.HorizontalScope o;
         if (argc == 2)
         {
             UnityEngine.GUILayoutOption[] a1;
             checkParams(l, 2, out a1);
             o = new UnityEngine.GUILayout.HorizontalScope(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.GUIStyle a1;
             checkType(l, 2, out a1);
             UnityEngine.GUILayoutOption[] a2;
             checkParams(l, 3, out a2);
             o = new UnityEngine.GUILayout.HorizontalScope(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(UnityEngine.GUIStyle), typeof(UnityEngine.GUILayoutOption[])))
         {
             System.String a1;
             checkType(l, 2, out a1);
             UnityEngine.GUIStyle a2;
             checkType(l, 3, out a2);
             UnityEngine.GUILayoutOption[] a3;
             checkParams(l, 4, out a3);
             o = new UnityEngine.GUILayout.HorizontalScope(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.Texture), typeof(UnityEngine.GUIStyle), typeof(UnityEngine.GUILayoutOption[])))
         {
             UnityEngine.Texture a1;
             checkType(l, 2, out a1);
             UnityEngine.GUIStyle a2;
             checkType(l, 3, out a2);
             UnityEngine.GUILayoutOption[] a3;
             checkParams(l, 4, out a3);
             o = new UnityEngine.GUILayout.HorizontalScope(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.GUIContent), typeof(UnityEngine.GUIStyle), typeof(UnityEngine.GUILayoutOption[])))
         {
             UnityEngine.GUIContent a1;
             checkType(l, 2, out a1);
             UnityEngine.GUIStyle a2;
             checkType(l, 3, out a2);
             UnityEngine.GUILayoutOption[] a3;
             checkParams(l, 4, out a3);
             o = new UnityEngine.GUILayout.HorizontalScope(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }