class

InstanceHandle<TRef>

A typed handle to a prefab instance, returned by SceneRoot.Instance. Carries the generated ref type TRef through the chain so On's selector can be type-checked against the instance's actual nested hierarchy.

public sealed class InstanceHandle<TRef> : InstanceHandle where TRef : PrefabRef
TRef

Constrained to PrefabRef

Compile-time scaffolding only — SceneBuilder parses the source text to build the scene, so these methods return handles for chaining but perform no work at runtime.

Members

Transformmethod

public new InstanceHandle<TRef> Transform((float x, float y, float z)? pos = null, (float x, float y, float z)? rot = null, (float x, float y, float z)? scale = null)

Set the local transform. Rotation is authored in Euler degrees.

Idmethod

public new InstanceHandle<TRef> Id(string id)

Assign an explicit, stable logical id (otherwise one is derived).

Overridemethod

public new InstanceHandle<TRef> Override(Action<OverrideHandle> configure)

Author property overrides on the instance root's own components, e.g. .Override(e => e.Set((Health x) => x.health, 50)). Targets are the instance root only — nested targets (including inside a nested prefab) are not authored here.

AddComponentmethod2 overloads

public new InstanceHandle<TRef> AddComponent<T>()

Add a component of type T to the instance root with no field overrides.

public new InstanceHandle<TRef> AddComponent<T>(Action<ComponentHandle<T>> configure)

Add a component of type T to the instance root and set its serialized fields in a closure.

RemoveComponentmethod

public new InstanceHandle<TRef> RemoveComponent<T>()

Remove a component of type T from the instance root (must exist on the source prefab).

Onmethod2 overloads

public InstanceHandle<TRef> On<TNode>(Func<TRef, TNode> selector, Action<ScopedHandle> closure)

Author overrides scoped to a nested target inside the instance's hierarchy, addressed by a compiler-checked member selector (e.g. t => t.Turret.Barrel). TNode is inferred from the selector's leaf property type.

public new InstanceHandle<TRef> On(string childPath, Action<ScopedHandle> closure)

String fallback that keeps TRef for chaining continuity.

RemoveChildmethod2 overloads

public InstanceHandle<TRef> RemoveChild<TNode>(Func<TRef, TNode> selector)

Remove an existing source child GameObject addressed by a compiler-checked member selector (e.g. t => t.LeftTurret.Antenna). A typo or a stale name is a COMPILE error, and a hierarchy rename auto-syncs the accessor — exactly like On. Use the string overload for a child with no generated ref type.

public new InstanceHandle<TRef> RemoveChild(string childPath)

Remove an existing child GameObject at childPath from the instance's hierarchy.

AddChildmethod2 overloads

public NodeHandle AddChild<TNode>(Func<TRef, TNode> parentSelector, string name)

Add a new child GameObject nested under a compiler-checked parent selector (e.g. t => t.LeftTurret). The PARENT is façade-checked (typo/stale = compile error, rename auto-syncs); the new child name stays a string — it is a genuinely new object with no façade type yet.

public NodeHandle AddChild<TNode>(Func<TRef, TNode> parentSelector, string name, Action<NodeHandle> configure)

Add a new child GameObject under a compiler-checked parent selector and configure it in a closure (the full NodeHandle authoring surface).

Generated from com.codescenes/Runtime/InstanceHandle.cs