Example #1
0
        public override void DrawGPUInstancerPrototypeActions()
        {
            if (Application.isPlaying)
            {
                return;
            }

            GUILayout.Space(10);

            GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_actions, GPUInstancerEditorConstants.Styles.boldLabel, false);

            GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.delete, Color.red, Color.white, FontStyle.Bold, Rect.zero,
                                                          () =>
            {
                if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deleteAreYouSure + "\n\"" + _prefabManager.selectedPrototype.ToString() + "\"", GPUInstancerEditorConstants.TEXT_remove, GPUInstancerEditorConstants.TEXT_cancel))
                {
                    if (EditorUtility.DisplayDialog(GPUInstancerEditorConstants.TEXT_deleteConfirmation, GPUInstancerEditorConstants.TEXT_deletePrototypeAreYouSure + "\n\"" + _prefabManager.selectedPrototype.ToString() + "\"", GPUInstancerEditorConstants.TEXT_delete, GPUInstancerEditorConstants.TEXT_keepPrototypeDefinition))
                    {
                        if (((GPUInstancerPrefabPrototype)_prefabManager.selectedPrototype).meshRenderersDisabled)
                        {
                            SetRenderersEnabled((GPUInstancerPrefabPrototype)_prefabManager.selectedPrototype, true);
                        }
                        _prefabManager.DeletePrototype(_prefabManager.selectedPrototype);
                        _prefabManager.selectedPrototype = null;
                    }
                    else
                    {
                        _prefabManager.DeletePrototype(_prefabManager.selectedPrototype, false);
                        _prefabManager.selectedPrototype = null;
                    }
                }
            });
            DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_delete);
        }