Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();

            reorderableList.DoLayoutList();

            EditorGUILayout.Space();

            lineWidth = EditorGUILayout.FloatField(new GUIContent("Line Width"), lineWidth);

            autoUpdate = EditorGUILayout.Toggle(new GUIContent("Auto Update"), autoUpdate);

            if (GUILayout.Button("Do Update"))
            {
                CornerRounder.RoundCorner(lineDrawer.Points1, lineDrawer.Points2, lineDrawer.Config);
            }

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(config, new GUIContent("Config"));

            EditorGUILayout.Space();

            if (configEditor != null)
            {
                EditorGUILayout.BeginVertical("box");

                configEditor.OnInspectorGUI();

                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.Space();

            SceneView.RepaintAll();

            if (ActiveEditorTracker.sharedTracker.isLocked)
            {
                if (GUILayout.Button("Unlock Inspector"))
                {
                    ActiveEditorTracker.sharedTracker.isLocked = false;
                    ActiveEditorTracker.sharedTracker.ForceRebuild();
                }
            }
            else
            {
                if (GUILayout.Button("Lock Inspector"))
                {
                    ActiveEditorTracker.sharedTracker.isLocked = true;
                    ActiveEditorTracker.sharedTracker.ForceRebuild();
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 2
0
        private void OnSceneUpdate(SceneView sceneView)
        {
            if (lineDrawer.Points1 == null || lineDrawer.Points2 == null || lineDrawer.Config == null)
            {
                return;
            }

            if (autoUpdate)
            {
                CornerRounder.RoundCorner(lineDrawer.Points1, lineDrawer.Points2, lineDrawer.Config);
            }

            DrawLine(lineDrawer.Points1, Color.blue);
            DrawLine(lineDrawer.Points2.ToArray(), Color.red);
        }