public static void ChooseComponentWithWindow(this GameObject parent, Type componentType, Action <Component> onSuccess, Action onFailure = null) { SelectComponentsDialogWindow.ShowWindow("Select component", "GameObject " + parent.name + " has multiple components of type " + componentType.Name + " in it's children. Please select suitable.", parent.GetComponentsExtended(componentType, true), onSuccess, onFailure); }
public static void ChooseComponentWithWindow <T>(this GameObject parent, Action <T> onSuccess, Action onFailure = null) where T : class { SelectComponentsDialogWindow.ShowWindow("Select component", "GameObject " + parent.name + " has multiple components of type " + typeof(T).Name + " in it's children. Please select suitable.", parent.GetComponentsExtended <T>(true), onSuccess, onFailure); }
public static void ShowWindow(string title, string caption, Component[] components, Action <Component> onSuccess, Action onFailure) { if (components == null || components.Length == 0) { onFailure(); return; } if (components.Length == 1) { onSuccess(components[0]); return; } SelectComponentsDialogWindow window = (SelectComponentsDialogWindow)GetWindow(typeof(SelectComponentsDialogWindow)); window.Show(title, caption, components, onSuccess, onFailure); }