UnityEditor.HandleUtility.PickGameObject C# (CSharp) Method

PickGameObject() static private method

static private PickGameObject ( Vector2 position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
position Vector2
ignore UnityEngine.GameObject
filter UnityEngine.GameObject
materialIndex int
return UnityEngine.GameObject
        internal static GameObject PickGameObject(Vector2 position, GameObject[] ignore, GameObject[] filter, out int materialIndex)
        {
            Camera current = Camera.current;
            int cullingMask = current.cullingMask;
            position = GUIClip.Unclip(position);
            position = EditorGUIUtility.PointsToPixels(position);
            position.y = (Screen.height - position.y) - current.pixelRect.yMin;
            return Internal_PickClosestGO(current, cullingMask, position, ignore, filter, out materialIndex);
        }

Same methods

HandleUtility::PickGameObject ( Vector2 position, GameObject ignore, int &materialIndex ) : GameObject
HandleUtility::PickGameObject ( Vector2 position, bool selectPrefabRoot ) : GameObject
HandleUtility::PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore ) : GameObject
HandleUtility::PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore, GameObject filter ) : GameObject
HandleUtility::PickGameObject ( Vector2 position, int &materialIndex ) : GameObject

Usage Example

示例#1
0
        private static void PickAllHandlesNonAlloc(HashSet <GameObject> results, Vector2 position, int limit = DefaultLimit)
        {
            if (!canPickHandles)
            {
                // HandleUtility.PickGameObject is not supported in those contexts
                Debug.LogWarning($"Cannot pick game objects in the current event: {e?.ToString() ?? "null"}");
                return;
            }

            GameObject result = null;

            var count = 0;

            do
            {
                var ignored = results.ToArray();

                result = HandleUtility.PickGameObject(position, false, ignored);

                // Ignored doesn't seem very reliable. Sometimes, an item included
                // in ignored will still be returned. That's a sign we should stop.
                if (results.Contains(result))
                {
                    result = null;
                }

                if (result != null)
                {
                    results.Add(result);
                }
            } while (result != null && count++ < limit);
        }
All Usage Examples Of UnityEditor.HandleUtility::PickGameObject