public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { VariablePropertyAttribute variableProperty = attribute as VariablePropertyAttribute; EditorGUI.BeginProperty(position, label, property); // Filter the variables by the types listed in the VariableProperty attribute Func <Variable, bool> compare = v => { if (variableProperty.VariableTypes.Length == 0) { return(true); } DebugLog.print(variableProperty.ToString()); return(variableProperty.VariableTypes.Contains <System.Type>(v.GetType())); }; VariableEditor.VariableField(property, label, FungusScriptWindow.GetFungusScript(), compare, (s, t, u) => (EditorGUI.Popup(position, s, t, u))); EditorGUI.EndProperty(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { VariablePropertyAttribute variableProperty = attribute as VariablePropertyAttribute; if (variableProperty == null) { return; } EditorGUI.BeginProperty(position, label, property); // Filter the variables by the types listed in the VariableProperty attribute Func <Variable, bool> compare = v => { if (v == null) { return(false); } if (variableProperty.VariableTypes.Length == 0) { return(true); } return(variableProperty.VariableTypes.Contains <System.Type>(v.GetType())); }; VariableEditor.VariableField(property, label, FlowchartWindow.GetFlowchart(), variableProperty.defaultText, compare, (s, t, u) => (EditorGUI.Popup(position, s, t, u))); EditorGUI.EndProperty(); }