private void DrawCreateNewVersionButton() { EditorGUI.BeginDisabledGroup(!_varwinObjectDescriptor.CurrentVersionWasBuilt); if (GUILayout.Button("Create new version")) { string message = @"Create a new version of the object?"; if (EditorUtility.DisplayDialog("Create a new version of the object", message, "Yes", "Cancel")) { _varwinObjectDescriptor.Guid = Guid.NewGuid().ToString(); _varwinObjectDescriptor.CurrentVersionWasBuilt = false; if (EditorUtility.DisplayDialog("Varwin Object Build Dialog", "Build new version of object? Editor will proceed to object building.", "Yes", "Cancel")) { if (CreateObjectUtils.ContainsObjectIdDuplicates(_gameObject)) { if (!DisplayDuplicatesObjectIdsDialog()) { return; } } if (!CheckTypesForValid()) { return; } BuildVarwinObject(_varwinObjectDescriptor); return; } } } EditorGUI.EndDisabledGroup(); }
private void DrawBuildButton() { bool isDisabled = !IsSelectable() || string.IsNullOrWhiteSpace(_nameProperty.stringValue) || string.IsNullOrWhiteSpace(_authorNameProperty.stringValue); EditorGUI.BeginDisabledGroup(isDisabled); if (GUILayout.Button("Build")) { if (CreateObjectUtils.ContainsObjectIdDuplicates(_gameObject)) { if (!DisplayDuplicatesObjectIdsDialog()) { return; } } if (!CheckTypesForValid()) { return; } if (EditorUtility.DisplayDialog("Varwin Object Build Dialog", "Editor will proceed to object building", "Yes", "Cancel")) { BuildVarwinObject(_varwinObjectDescriptor); return; } } if (!string.Equals(_varwinObjectDescriptor.Guid, _varwinObjectDescriptor.RootGuid) || _varwinObjectDescriptor.CurrentVersionWasBuilt) { DrawCreateNewVersionButton(); } EditorGUI.EndDisabledGroup(); if (string.IsNullOrWhiteSpace(_nameProperty.stringValue)) { EditorGUILayout.HelpBox("Object type name is empty", MessageType.Error); } if (!IsSelectable()) { EditorGUILayout.HelpBox("Object is not selectable. Add Rigidbody and Collider to the root object", MessageType.Error); } if (CreateObjectUtils.ContainsObjectIdDuplicates(_gameObject)) { EditorGUILayout.HelpBox("Object contains duplicate Object Ids", MessageType.Warning); } }