InstanceHandle
A handle to a prefab instance in a scene definition, returned by SceneRoot.Instance / NodeHandle.Instance. Chain calls to configure the instance's root transform and nest plain children.
public class InstanceHandle : SceneObjectHandleCompile-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.
A prefab instance is authored as one whole unit: you do not author child GameObjects inside its hierarchy. Change what the instance carries with Override, AddComponent and RemoveComponent, and reach a nested target with On.
Members
Transformmethod
public InstanceHandle 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 InstanceHandle Id(string id)Assign an explicit, stable logical id (otherwise one is derived).
Addmethod2 overloads
public NodeHandle Add(string name)Add a plain child GameObject alongside the instance's hierarchy.
public NodeHandle Add(string name, Action<NodeHandle> configure)Add a plain child GameObject and configure it in a closure.
Overridemethod
public InstanceHandle 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 InstanceHandle AddComponent<T>()Add a component of type T to the instance root with no field overrides.
public InstanceHandle 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 InstanceHandle RemoveComponent<T>()Remove a component of type T from the instance root (must exist on the source prefab).
Onmethod
public InstanceHandle On(string childPath, Action<ScopedHandle> closure)Author overrides scoped to a nested target inside the instance's hierarchy, addressed by child path (e.g. "Turret/Barrel"). Fallback for the typed selector overload on InstanceHandle<TRef> when no generated ref type is available.
AddChildmethod2 overloads
public NodeHandle AddChild(string parentPath, string name)Add a new child GameObject nested under parentPath in the instance's hierarchy ("" = the instance root).
public NodeHandle AddChild(string parentPath, string name, Action<NodeHandle> configure)Add a new child GameObject nested under parentPath and configure it in a closure (the full NodeHandle authoring surface).
RemoveChildmethod
public InstanceHandle RemoveChild(string childPath)Remove an existing child GameObject at childPath from the instance's hierarchy.