Skip to content
Task guideDevelopmentEngine ccf7d03f

Use ContentReadScope when a consumer needs ordered content roots without depending directly on the Scene or Asset owner. The producer supplies registered identities; the scope retains weak identity snapshots, not live root objects.

The following host helper counts compatible roots during one synchronous control-thread operation. Its caller supplies the current registered root identities; it does not create an identity domain or change object ownership.

using System.Collections.Generic;
using Inno.Core.Identity;
using Inno.References;
public static class ContentInspection
{
public static int Count<T>(IEnumerable<Identity> roots) where T : IdentityObject
{
using var scope = new ContentReadScope(roots);
return scope.GetValues<T>().Count;
}
}

For a real renderer or audio consumer, copy the needed values into its neutral domain snapshot during this operation. Do not pass the returned live objects to a background callback or retain them for a later frame.

  • Roots must be registered and have distinct persistent IDs. An optional active content ID must belong to the captured set.
  • GetValues<T> omits stale or incompatible roots. An empty result can mean no compatible live content, not a broken scope.
  • TryGetValue<T> selects a root by persistent ID but resolves its originally captured runtime slot. It does not rebind to a replacement generation with the same persistent ID.
  • Lookup requires the capture thread and fails after disposal. Immutable identity metadata remains inspectable after disposal.
  • The caller owns the scope; disposing it revokes lookups without disposing any roots.

Host code uses Inno.References. The actual runtime script projection selects this type under InnoEngine.References; it does not expose host recovery composition just because both live in the same CLR project.

Continue with ownership or the precise content-read contract.