Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("VRSF Parameters", EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();
            Undo.RecordObject(_scrollview.gameObject, "Add BoxCollider");

            if (_scrollview.gameObject.GetComponent <BoxCollider>() != null)
            {
                EditorGUILayout.LabelField("Set Box Collider Automatically", EditorStyles.miniBoldLabel);
                EditorGUILayout.PropertyField(_setColliderAuto);
                CheckEndChanges();
            }
            else
            {
                EditorGUILayout.LabelField("This option required a BoxCollider Component.", EditorStyles.miniLabel);
                _scrollview.SetColliderAuto = false;
                _scrollview.SetColliderAuto = EditorGUILayout.ToggleLeft("Set Box Collider Automatically", false);

                // Add a button to replace the collider by a BoxCollider2D
                if (GUILayout.Button("Add BoxCollider"))
                {
                    DestroyImmediate(_scrollview.GetComponent <Collider>());
                    _scrollview.gameObject.AddComponent <BoxCollider>();
                    _scrollview.SetColliderAuto = true;
                }
            }

            EditorGUI.BeginChangeCheck();
            Undo.RecordObject(_scrollview, "Direction");
            EditorGUILayout.LabelField("The direction of this ScrollView", EditorStyles.miniBoldLabel);
            EditorGUILayout.PropertyField(_direction);
            CheckEndChanges();

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Basic ScrollRect Parameters", EditorStyles.boldLabel);

            EditorGUILayout.Space();

            base.OnInspectorGUI();
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("VRSF Parameters", EditorStyles.boldLabel);
            EditorGUILayout.Space();

            Undo.RecordObject(vrScrollRect.gameObject, "Add BoxCollider");

            if (vrScrollRect.gameObject.GetComponent <BoxCollider>() != null)
            {
                vrScrollRect.SetColliderAuto = EditorGUILayout.ToggleLeft("Set Box Collider Automatically", vrScrollRect.SetColliderAuto);
            }
            else
            {
                EditorGUILayout.LabelField("This option required a BoxCollider Component.", EditorStyles.miniLabel);
                vrScrollRect.SetColliderAuto = false;
                vrScrollRect.SetColliderAuto = EditorGUILayout.ToggleLeft("Set Box Collider Automatically", false);

                // Add a button to replace the collider by a BoxCollider2D
                if (GUILayout.Button("Add BoxCollider"))
                {
                    vrScrollRect.gameObject.AddComponent <BoxCollider>();
                    DestroyImmediate(vrScrollRect.GetComponent <Collider>());
                    vrScrollRect.SetColliderAuto = true;
                }
            }

            vrScrollRect.Direction = (EUIDirection)EditorGUILayout.EnumPopup("Direction", vrScrollRect.Direction);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Basic ScrollRect Parameters", EditorStyles.boldLabel);

            EditorGUILayout.Space();

            base.OnInspectorGUI();

            serializedObject.ApplyModifiedProperties();
            serializedObject.Update();
        }