public void Show(ReferenceCallback onReferenceChanged, ReferenceCallback onSelectionConfirmed, NameGetter referenceNameGetter, NameGetter referenceDisplayNameGetter, object[] references, object initialReference, bool includeNullReference, string title, Canvas referenceCanvas) { initialValue = initialReference; this.onReferenceChanged = onReferenceChanged; this.onSelectionConfirmed = onSelectionConfirmed; this.referenceNameGetter = referenceNameGetter ?? ((reference) => reference.GetNameWithType()); this.referenceDisplayNameGetter = referenceDisplayNameGetter ?? ((reference) => reference.GetNameWithType()); if (referenceCanvas && this.referenceCanvas != referenceCanvas) { this.referenceCanvas = referenceCanvas; Canvas canvas = GetComponent <Canvas>(); canvas.CopyValuesFrom(referenceCanvas); canvas.sortingOrder = Mathf.Max(1000, referenceCanvas.sortingOrder + 100); } panel.rectTransform.anchoredPosition = Vector2.zero; gameObject.SetActive(true); selectPromptText.text = title; currentlySelectedObject = initialReference; GenerateReferenceItems(references, includeNullReference); #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL // On desktop platforms, automatically focus on search field // We don't do the same on mobile because immediately showing the on-screen keyboard after presenting the window wouldn't be nice searchBar.ActivateInputField(); #endif }
public void Close() { onReferenceChanged = null; onSelectionConfirmed = null; referenceNameGetter = null; referenceDisplayNameGetter = null; initialValue = null; currentlySelectedObject = null; currentlySelectedItem = null; references.Clear(); filteredReferences.Clear(); gameObject.SetActive(false); }