public static bool PropertyField(SerializedObject obj, string prop, bool includeChildren) { if (obj == null) { throw new System.ArgumentNullException("obj"); } var serial = obj.FindProperty(prop); if (serial != null) { EditorGUI.BeginChangeCheck(); //EditorGUILayout.PropertyField(serial, includeChildren); SPEditorGUILayout.PropertyField(serial, includeChildren); return(EditorGUI.EndChangeCheck()); } return(false); }
public static bool DrawDefaultInspectorExcept(SerializedObject serializedObject, params string[] propsNotToDraw) { if (serializedObject == null) { throw new System.ArgumentNullException("serializedObject"); } EditorGUI.BeginChangeCheck(); var iterator = serializedObject.GetIterator(); for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false) { if (propsNotToDraw == null || !propsNotToDraw.Contains(iterator.name)) { //EditorGUILayout.PropertyField(iterator, true); SPEditorGUILayout.PropertyField(iterator, true); } } return(EditorGUI.EndChangeCheck()); }
protected override void OnSPInspectorGUI() { this.serializedObject.Update(); this.DrawPropertyField(EditorHelper.PROP_SCRIPT); var propFileName = this.serializedObject.FindProperty(PROP_BUILDFILENAME); EditorGUILayout.PropertyField(propFileName); if (!string.IsNullOrEmpty(propFileName.stringValue)) { var propBuildDir = this.serializedObject.FindProperty(PROP_BUILDDIR); propBuildDir.stringValue = SPEditorGUILayout.FolderPathTextfield(EditorHelper.TempContent(propBuildDir.displayName, propBuildDir.tooltip), propBuildDir.stringValue, "Build Directory"); } this.DrawPropertyField(PROP_VERSION); this.DrawScenes(); this.DrawBuildOptions(); this.DrawInputSettings(); this.DrawPlayerSettingOverrides(); this.serializedObject.ApplyModifiedProperties(); //build button if (this.serializedObject.isEditingMultipleObjects) { return; } EditorGUILayout.Space(); this.DrawBuildButtons(); }
public static bool PropertyField(SerializedObject obj, string prop, string label, bool includeChildren) { return(SPEditorGUILayout.PropertyField(obj, prop, EditorHelper.TempContent(label), includeChildren)); }
public static bool PropertyField(SerializedProperty property, bool includeChildren, params GUILayoutOption[] options) { return(SPEditorGUILayout.PropertyField(property, (GUIContent)null, includeChildren, options)); }
public static bool PropertyField(SerializedProperty property, GUIContent label, params GUILayoutOption[] options) { return(SPEditorGUILayout.PropertyField(property, label, false, options)); }
public bool DrawPropertyField(string prop, GUIContent label, bool includeChildren) { return(SPEditorGUILayout.PropertyField(this.serializedObject, prop, label, includeChildren)); }
public bool DrawPropertyField(string prop) { return(SPEditorGUILayout.PropertyField(this.serializedObject, prop)); }
public sealed override void OnInspectorGUI() { if (!(this.target is SPComponent) && !SpacepuppySettings.UseSPEditorAsDefaultEditor) { base.OnInspectorGUI(); return; } this.OnBeforeSPInspectorGUI(); EditorGUI.BeginChangeCheck(); //draw header infobox if needed this.DrawDefaultInspectorHeader(); this.OnSPInspectorGUI(); this.DrawDefaultInspectorFooters(); if (EditorGUI.EndChangeCheck()) { //do call onValidate PropertyHandlerValidationUtility.OnInspectorGUIComplete(this.serializedObject, true); this.OnValidate(); if (SpacepuppySettings.SignalValidateReceiver) { foreach (var obj in this.serializedObject.targetObjects) { var iterator = serializedObject.GetIterator(); while (iterator.Next(true)) { if (iterator.propertyType == SerializedPropertyType.ObjectReference) { continue; } var validated = EditorHelper.GetTargetObjectOfProperty(iterator, obj) as IValidateReceiver; validated?.OnValidate(); } } } } else { PropertyHandlerValidationUtility.OnInspectorGUIComplete(this.serializedObject, false); } if (_shownFields != null && UnityEngine.Application.isPlaying) { GUILayout.Label("Runtime Values", EditorStyles.boldLabel); foreach (var info in _shownFields) { var cache = SPGUI.DisableIf(info.Attrib.Readonly); var value = DynamicUtil.GetValue(this.target, info.MemberInfo); EditorGUI.BeginChangeCheck(); value = SPEditorGUILayout.DefaultPropertyField(info.Label, value, DynamicUtil.GetReturnType(info.MemberInfo)); if (EditorGUI.EndChangeCheck()) { DynamicUtil.SetValue(this.target, info.MemberInfo, value); } cache.Reset(); } } }