InteriorItem
A concrete, networked, interactable placeable object within the interior system. Extends InteriorItemBase and implements Unity’s IPointerDownHandler for mouse/touch interaction. Handles the editing lifecycle, server sync, and conditional remote updates of user-placed objects.
public class InteriorItem : InteriorItemBase, IPointerDownHandler
Purpose
This class provides the full behavior of a buildable item in the scene:
- 🧩 Supports interaction, editing, and nesting
- 💾 Synchronizes with Firebase backend when updates are confirmed
- 🎮 Handles user input, selection, and visual state changes
- 🧼 Provides cleanup and rollback capabilities for invalid placements
- 🛠️ Includes Unity Editor helpers for collider/visual setup
Interaction Flow
OnPointerDown(PointerEventData)
Triggers item selection logic:
- Only reacts if player has authority and isn't UI-blocked
- Ensures active state is idle and remote data is not pending
- Selects the item for editing via
SetAsSelected
RemoveItem()
Removes the item from the scene or sends it to storage (if owned). Also unregisters from replay tracking.
CancelSelection()
Aborts editing:
- If item isn't deployed, destroys it
- Otherwise, reverts to remote data and clears pending flags
UpdateItemRemote()
Validates placement and pushes changes to the server. Also updates nested children recursively.
Focus and Visual Handling
OnFocusLost()
- Ends editing state
- Optionally syncs changes (currently commented out)
DeselectItem()
- Ends editing for self and children
- Resets visual outline and invalid material states
Editor Utilities
Available under #if UNITY_EDITOR:
GatherCollider(): Auto-populatesplayerCollidersfrom childrenCheckForNestedInteriorItemVisual(): AssignsloadedVisualControllerSearchForItem(): (Stubbed out) searches for a matchingBuildItemDataby name
Utilities
ResetToRemoteData()
Repositions and rotates item to Firebase state.
EnableInteraction() / DisableInteraction()
Enables or disables collider-based interactivity.
Integration
- Inherits all capabilities from
InteriorItemBase - Works with:
InteriorManagerReplayTrackablePlacementSurfaceInteriorItemVisual
- Uses Fusion networking and Firebase persistence
Remarks
This is the user-facing item component within the dynamic placement system. It focuses on ensuring accurate interaction fidelity, robust rollback handling, and extensibility for future interaction layers or state tracking.