private static void ReplaceSelection()
        {
            if (hasExecuted)
            {
                return;
            }

            var rect = new Rect(mousePosition, new Vector2(240, 360));

            ReplacePrefabSearchPopup.Show(rect);

            EditorApplication.delayCall += () => hasExecuted = false;
        }
Ejemplo n.º 2
0
        public static void Show(Rect rect)
        {
            var windows = Resources.FindObjectsOfTypeAll <ReplacePrefabSearchPopup>();

            window = windows.Length != 0 ? windows[0] : CreateInstance <ReplacePrefabSearchPopup>();

            window.Init();

            window.startPos  = rect.position;
            window.startSize = rect.size;

            window.position = new Rect(rect.position, rect.size);
            // Need to predict start window size to avoid trash frame
            window.SetInitialSize();

            // This type of window supports resizing, but is also persistent, so we need to close it manually
            window.ShowPopup();

            //onSelectEntry += _ => window.Close();
        }