Unity-Technologies/UnityCsReference · error · NotImplementedException

GetRenderersHiddenResultBits(ReadOnlySpan<int>) is obsolete.

Error message

GetRenderersHiddenResultBits(ReadOnlySpan<int>) is obsolete. Use GetRenderersHiddenResultBits(ReadOnlySpan<EntityId>) instead.

What it means

EditorCameraUtils.GetRenderersHiddenResultBits(ReadOnlySpan<int>) is marked [Obsolete(..., true)] (error=true) and replaced by GetRenderersHiddenResultBits(ReadOnlySpan<EntityId>, Span<ulong>). The body throws NotImplementedException to fail at runtime for any reflective invocation. Renderer identifiers are now EntityIds, and the hidden-result format packs bits into ulong chunks, so the int overload is fully removed from the supported surface.

Source

Thrown at Editor/Mono/Camera/EditorCameraUtils.bindings.cs:40

        [System.Obsolete("GetRenderersFilteringResults(ReadOnlySpan<int>) is obsolete. Use GetRenderersFilteringResults(ReadOnlySpan<EntityId>) instead.", true)]
        public static unsafe void GetRenderersFilteringResults(ReadOnlySpan<int> rendererIDs, Span<bool> results)
        {
            throw new System.NotImplementedException("GetRenderersFilteringResults(ReadOnlySpan<int>) is obsolete. Use GetRenderersFilteringResults(ReadOnlySpan<EntityId>) instead.");
        }

        public static unsafe void GetRenderersFilteringResults(ReadOnlySpan<EntityId> rendererIDs, Span<bool> results)
        {
            if (rendererIDs.Length != results.Length)
                throw new ArgumentException("rendererIDs and results NativeArrays don't match in length.");

            GetRenderersFilteringResultsImpl(rendererIDs, results);
        }

        [System.Obsolete("GetRenderersHiddenResultBits(ReadOnlySpan<int>) is obsolete. Use GetRenderersHiddenResultBits(ReadOnlySpan<EntityId>) instead.", true)]
        public static unsafe void GetRenderersHiddenResultBits(ReadOnlySpan<int> rendererIDs, Span<ulong> resultBits)
        {
            throw new System.NotImplementedException("GetRenderersHiddenResultBits(ReadOnlySpan<int>) is obsolete. Use GetRenderersHiddenResultBits(ReadOnlySpan<EntityId>) instead.");
        }

        public static unsafe void GetRenderersHiddenResultBits(ReadOnlySpan<EntityId> rendererIDs, Span<ulong> resultBits)
        {
            const int kBitsPerChunkCount = sizeof(ulong) * 8;

            int resultBitsLengthExpected = (rendererIDs.Length + kBitsPerChunkCount - 1) / kBitsPerChunkCount;

            if (resultBitsLengthExpected != resultBits.Length)
                throw new ArgumentException("Unexpected resultBits Span length. The expected length of resultBits Span should be equal to the formula: (rendererIDs.Length + 63) / 64");

            GetRenderersHiddenResultBitsImpl(rendererIDs, resultBits);
        }

        [FreeFunction("EditorCameraUtilsScripting::RenderToCubemap")]
        static extern int RenderToCubemapImpl(Camera camera, Texture target, [DefaultValue("63")] int faceMask, StaticEditorFlags culledFlags);

        [FreeFunction("EditorCameraUtilsScripting::GetRenderersFilteringResults")]

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Switch to GetRenderersHiddenResultBits(ReadOnlySpan<EntityId>, Span<ulong>).
  2. Convert int renderer IDs to EntityId and size the resultBits span per (ids.Length + 63) / 64.
  3. Remove all int-overload references from your code and dependencies.

Example fix

// before
EditorCameraUtils.GetRenderersHiddenResultBits(rendererIntIds, bits);

// after
int chunks = (rendererEntityIds.Length + 63) / 64;
Span<ulong> bits = stackalloc ulong[chunks];
EditorCameraUtils.GetRenderersHiddenResultBits(rendererEntityIds, bits);
Defensive patterns

Strategy: type-guard

Validate before calling

// Use the EntityId overload and size resultBits as (ids.Length + 63) / 64 ulong chunks.

Type guard

static void Call(ReadOnlySpan<EntityId> ids, Span<ulong> bits) => EditorCameraUtils.GetRenderersHiddenResultBits(ids, bits);

Prevention

When it happens

Trigger: Calling the int-based GetRenderersHiddenResultBits overload. The obsolete attribute makes this a compile error; the throw covers reflective/dynamic calls.

Common situations: Version upgrade where renderer IDs moved from int to EntityId; unmigrated tooling or third-party package code; reflection-based invocation.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/4752125885c09c8c. Report an issue: GitHub.