public static ReorderableList CreateObjectList( SerializedObject serializedObject, SerializedProperty serializedProperty, IEnumerable <GameObject> objectsToExclude, Action <List <GameObject> > objectsWillAdd) { return(CreateReorderableList <GameObject>(serializedObject, serializedProperty, () => { ObjectPickerWindow.Open(objectsToExclude, x => objectsWillAdd(x)); })); }
public static void Open(IEnumerable <GameObject> objectsToExclude, Action <List <GameObject> > onAddButtonPushed) { if (pickerWindow == null) { pickerWindow = CreateInstance <ObjectPickerWindow>(); pickerWindow.titleContent = new GUIContent("Select Object"); } pickerWindow.OnAddButtonPushed = onAddButtonPushed; pickerWindow.treeView = new PickerTreeView <GameObject>( new TreeViewState(), () => EnumerateMeshObjects().Where(x => !objectsToExclude.Contains(x)), EditorGUIUtility.IconContent("PrefabNormal Icon").image as Texture2D); pickerWindow.treeView.ItemDoubleClicked = (x) => { onAddButtonPushed(new List <GameObject> { x }); pickerWindow.Close(); }; pickerWindow.treeView.Reload(); pickerWindow.ShowAuxWindow(); }