AttachmentPointStateHolder¶
Topic state holder for AttachmentPoint. Captures and restores Octoputs-specific aspects of an attachment point.
Namespace: Octoputs.State
Implements: StateHolderForComponent<SmartAttachmentPoint, AttachmentPoint, IAttachmentPointStateOperation>
Overview¶
Sits inside an ObjectStateHolder (typically nested under a TargetedStateHolder). Resolves the target via SmartAttachmentPoint and runs each IAttachmentPointStateOperation against it on capture / restore.
Operations¶
| Operation | What it captures | Restore behaviour |
|---|---|---|
| Held Object | Which AttachableObject is currently on the point. | Snaps the saved Attachable back via InstantAttach. If the point was empty in the save and currently holds something, force-detaches via InstantDetach. |
The Held Object operation uses a SavedRef internally — the held Attachable can be a creator-spawned instance or a permanent scene ref, and the SceneState resolves it through its Key registries on restore.
Wiring up¶
For a scene where attachment points persist their occupants:
- On each AttachmentPoint, add an ObjectStateHolder.
- In its Holders list, add a Targeted State Holder with Target: Self.
- Inside the targeted holder, add an Attachment Point State entry.
- In its Operations list, add a Held Object entry.
- Drop a SceneState in the scene; register the AttachmentPoint as a Permanent Ref and the Attachable creator as a Creator.
On save, SceneState walks the registered AttachmentPoints, captures their state via the holder list, encodes the held object reference (which Attachable from which creator). On restore, SceneState spawns the saved Attachables back, then resolves each point's Held Object reference and applies it via Instant Attach.