Exemple #1
0
        public override void OnInspectorGUI()
        {
            _editor.OnInspectorGUI();

            CreateSpriteAssistEditor();

            if (_spriteInspector == null)
            {
                return;
            }

            GUIStyle  style         = EditorStyles.foldout;
            FontStyle previousStyle = style.fontStyle;

            style.fontStyle = FontStyle.Bold;
            _isOpen         = EditorGUILayout.Foldout(_isOpen, "SpriteAssist", style);
            style.fontStyle = previousStyle;

            if (_isOpen)
            {
                _spriteInspector.OnInspectorGUI();

                var oldColor = GUI.color;
                GUI.color = Color.black;

                using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    GUI.color = oldColor;

                    var width = EditorGUIUtility.currentViewWidth;
                    _spriteInspector.DrawPreview(GUILayoutUtility.GetRect(width, 300));
                }

                if (Renderer is SpriteRenderer && GUILayout.Button("Swap to Mesh Prefab"))
                {
                    RendererUtil.SwapRendererSpriteToMeshInHierarchy(targets);
                    EditorUtility.DisplayDialog("SpriteAssist", "Done", "OK");
                }
            }
        }
Exemple #2
0
 private static void SwapInHierarchySelected()
 {
     RendererUtil.SwapRendererSpriteToMeshInHierarchy(Selection.objects);
     EditorUtility.DisplayDialog("SpriteAssist", "Done", "OK");
 }