Unity-Technologies/UnityCsReference · error · InvalidOperationException
Get GetSelectionOutlineIncludeExcludeList is obsolete, use G
Error message
Get GetSelectionOutlineIncludeExcludeList is obsolete, use GetSelectionOutlineIncludeExcludeEntityIdList instead.
What it means
GetSelectionOutlineIncludeExcludeList is marked [Obsolete(..., true)] and unconditionally throws InvalidOperationException. The selection outline system migrated from int instance IDs to EntityId structs; the replacement is GetSelectionOutlineIncludeExcludeEntityIdList.
Source
Thrown at Editor/Mono/Handles/HandleUtility.cs:1238
s_RendererExcludeBuffer.Clear();
s_EntityIncludeBuffer.Clear();
s_EntityExcludeBuffer.Clear();
Renderer[] deepSelection = Selection.GetFiltered<Renderer>(SelectionMode.Deep);
ExtractRenderersEntityIds(deepSelection, s_RendererIncludeBuffer);
ExtractEntities(Selection.objects, s_EntityIncludeBuffer);
return new PickingIncludeExcludeEntityIdList(s_RendererIncludeBuffer, null, s_EntityIncludeBuffer, null, allocator);
}
[Obsolete("Use GetPickingIncludeExcludeEntityIdList instead. This method will be removed in a future version.", true)]
public static PickingIncludeExcludeList GetPickingIncludeExcludeList(Allocator allocator = Allocator.Persistent)
{
throw new InvalidOperationException("Get GetPickingIncludeExcludeList is obsolete, use GetPickingIncludeExcludeEntityIdList instead.");
}
[Obsolete("Use GetSelectionOutlineIncludeExcludeEntityIdList instead. This method will be removed in a future version.", true)]
public static PickingIncludeExcludeList GetSelectionOutlineIncludeExcludeList(Allocator allocator = Allocator.Persistent)
{
throw new InvalidOperationException("Get GetSelectionOutlineIncludeExcludeList is obsolete, use GetSelectionOutlineIncludeExcludeEntityIdList instead.");
}
internal static PickingObject PickObject(Vector2 guiPosition,
bool selectPrefabRoot = false,
List<PickingObject> ignore = null,
List<PickingObject> filter = null)
{
Camera cam = Camera.current;
int layers = cam.cullingMask;
var screenPosition = GUIPointToScreenPixelCoordinate(guiPosition);
var sceneView = SceneView.lastActiveSceneView;
bool drawGizmos = sceneView != null && sceneView.drawGizmos;
PickingObject picked = PickingObject.Empty;
s_PickingInclude = filter;
s_PickingExclude = ignore;
if (pickClosestGameObjectDelegate != null)View on GitHub (pinned to 225b0fbdb5)
Solutions
- Replace all calls to GetSelectionOutlineIncludeExcludeList with GetSelectionOutlineIncludeExcludeEntityIdList.
- Update third-party packages to versions targeting the current Unity editor.
- Remove any reflection-based invocation paths.
Example fix
// before var list = HandleUtility.GetSelectionOutlineIncludeExcludeList(Allocator.Persistent); // after var list = HandleUtility.GetSelectionOutlineIncludeExcludeEntityIdList(Allocator.Persistent);
Defensive patterns
Strategy: validation
Validate before calling
// The [Obsolete(true)] attribute makes this a compile-time error. // Grep the codebase and replace: // HandleUtility.GetSelectionOutlineIncludeExcludeList // -> HandleUtility.GetSelectionOutlineIncludeExcludeEntityIdList
Prevention
- Track Unity editor API migration guides after each major version upgrade.
- Grep for GetSelectionOutlineIncludeExcludeList and replace with the EntityId variant proactively.
When it happens
Trigger: Calling HandleUtility.GetSelectionOutlineIncludeExcludeList() from source code (compile error) or via reflection (runtime throw).
Common situations: Post-upgrade code or third-party packages that compute selection-outline include/exclude lists using the old int-based API.
Related errors
- Use DrawOutline(EntityId[], EntityId[], Color, Color, float)
- Use DrawOutline(EntityId[], Color, float) instead.
- Get GetPickingIncludeExcludeList is obsolete, use GetPicking
- HierarchyProperty is deprecated. Use HierarchyIterator inste
- GetRenderersFilteringResults(ReadOnlySpan<int>) is obsolete.
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/9f7b94a2b1d053ce.
Report an issue: GitHub.