示例#1
0
        private static void SwapInProject()
        {
            Object obj = Selection.activeObject;
            string s   = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(obj);

            RendererUtil.SwapAllRecursively(s);
            EditorUtility.DisplayDialog("SpriteAssist", "Done", "OK");
        }
示例#2
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");
                }
            }
        }
示例#3
0
 private static void SwapInHierarchySelected()
 {
     RendererUtil.SwapRendererSpriteToMeshInHierarchy(Selection.objects);
     EditorUtility.DisplayDialog("SpriteAssist", "Done", "OK");
 }