internal void Show(UnityEngine.Object obj, Type requiredType, SerializedProperty property, bool allowSceneObjects, List <int> allowedInstanceIDs) { this.m_AllowSceneObjects = allowSceneObjects; this.m_IsShowingAssets = true; this.m_AllowedIDs = allowedInstanceIDs; string text = string.Empty; if (property != null) { text = property.objectReferenceTypeString; obj = property.objectReferenceValue; UnityEngine.Object targetObject = property.serializedObject.targetObject; if (targetObject != null && EditorUtility.IsPersistent(targetObject)) { this.m_AllowSceneObjects = false; } } else { if (requiredType != null) { text = requiredType.Name; } } if (this.m_AllowSceneObjects) { if (obj != null) { if (typeof(Component).IsAssignableFrom(obj.GetType())) { obj = ((Component)obj).gameObject; } this.m_IsShowingAssets = (EditorUtility.IsPersistent(obj) || ObjectSelector.GuessIfUserIsLookingForAnAsset(text, false)); } else { this.m_IsShowingAssets = ObjectSelector.GuessIfUserIsLookingForAnAsset(text, true); } } else { this.m_IsShowingAssets = true; } this.m_DelegateView = GUIView.current; this.m_RequiredType = text; this.m_SearchFilter = string.Empty; this.m_OriginalSelection = obj; this.m_ModalUndoGroup = Undo.GetCurrentGroup(); ContainerWindow.SetFreezeDisplay(true); base.ShowWithMode(ShowMode.AuxWindow); base.title = "Select " + text; Rect position = this.m_Parent.window.position; position.width = EditorPrefs.GetFloat("ObjectSelectorWidth", 200f); position.height = EditorPrefs.GetFloat("ObjectSelectorHeight", 390f); base.position = position; base.minSize = new Vector2(200f, 335f); base.maxSize = new Vector2(10000f, 10000f); this.SetupPreview(); base.Focus(); ContainerWindow.SetFreezeDisplay(false); this.m_FocusSearchFilter = true; this.m_Parent.AddToAuxWindowList(); int num = (!(obj != null)) ? 0 : obj.GetInstanceID(); if (property != null && property.hasMultipleDifferentValues) { num = 0; } if (ObjectSelector.ShouldTreeViewBeUsed(text)) { this.m_ObjectTreeWithSearch.Init(base.position, this, new UnityAction <ObjectTreeForSelector.TreeSelectorData>(this.CreateAndSetTreeView), new UnityAction <TreeViewItem>(this.TreeViewSelection), new UnityAction(this.ItemWasDoubleClicked), num, 0); } else { this.InitIfNeeded(); this.m_ListArea.InitSelection(new int[] { num }); if (num != 0) { this.m_ListArea.Frame(num, true, false); } } }
internal void Show(UnityEngine.Object obj, Type requiredType, SerializedProperty property, bool allowSceneObjects, List <int> allowedInstanceIDs, Action <UnityEngine.Object> onObjectSelectorClosed, Action <UnityEngine.Object> onObjectSelectedUpdated) { this.m_ObjectSelectorReceiver = null; this.m_AllowSceneObjects = allowSceneObjects; this.m_IsShowingAssets = true; this.m_AllowedIDs = allowedInstanceIDs; this.m_OnObjectSelectorClosed = onObjectSelectorClosed; this.m_OnObjectSelectorUpdated = onObjectSelectedUpdated; if (property != null) { if (requiredType == null) { ScriptAttributeUtility.GetFieldInfoFromProperty(property, out requiredType); if (requiredType == null) { this.m_RequiredType = this.s_MatchPPtrTypeName.Match(property.type).Groups[1].Value; } } obj = property.objectReferenceValue; this.m_ObjectBeingEdited = property.serializedObject.targetObject; if (this.m_ObjectBeingEdited != null && EditorUtility.IsPersistent(this.m_ObjectBeingEdited)) { this.m_AllowSceneObjects = false; } } if (this.m_AllowSceneObjects) { if (obj != null) { if (typeof(Component).IsAssignableFrom(obj.GetType())) { obj = ((Component)obj).gameObject; } this.m_IsShowingAssets = EditorUtility.IsPersistent(obj); } else { this.m_IsShowingAssets = (requiredType != typeof(GameObject) && !typeof(Component).IsAssignableFrom(requiredType)); } } else { this.m_IsShowingAssets = true; } this.m_DelegateView = GUIView.current; if (requiredType != null) { this.m_RequiredType = ((!typeof(ScriptableObject).IsAssignableFrom(requiredType) && !typeof(MonoBehaviour).IsAssignableFrom(requiredType)) ? requiredType.Name : requiredType.FullName); } this.m_SearchFilter = ""; this.m_OriginalSelection = obj; this.m_ModalUndoGroup = Undo.GetCurrentGroup(); ContainerWindow.SetFreezeDisplay(true); base.ShowWithMode(ShowMode.AuxWindow); base.titleContent = EditorGUIUtility.TrTextContent("Select " + ((requiredType != null) ? requiredType.Name : this.m_RequiredType), null, null); Rect position = this.m_Parent.window.position; position.width = EditorPrefs.GetFloat("ObjectSelectorWidth", 200f); position.height = EditorPrefs.GetFloat("ObjectSelectorHeight", 390f); base.position = position; base.minSize = new Vector2(200f, 335f); base.maxSize = new Vector2(10000f, 10000f); this.SetupPreview(); base.Focus(); ContainerWindow.SetFreezeDisplay(false); this.m_FocusSearchFilter = true; this.m_Parent.AddToAuxWindowList(); int num = (!(obj != null)) ? 0 : obj.GetInstanceID(); if (property != null && property.hasMultipleDifferentValues) { num = 0; } if (ObjectSelector.ShouldTreeViewBeUsed(requiredType)) { this.m_ObjectTreeWithSearch.Init(base.position, this, new UnityAction <ObjectTreeForSelector.TreeSelectorData>(this.CreateAndSetTreeView), new UnityAction <TreeViewItem>(this.TreeViewSelection), new UnityAction(this.ItemWasDoubleClicked), num, 0); } else { this.InitIfNeeded(); this.m_ListArea.InitSelection(new int[] { num }); if (num != 0) { this.m_ListArea.Frame(num, true, false); } } }