InteriorRoom
The InteriorRoom class represents a modular interior space used in dynamic room-based environments. It manages visual activation, grid previews, camera confiners, and placement surfaces β all synchronized in a multiplayer context via Fusion networking.
π§© Overviewβ
public class InteriorRoom : NetworkBehaviour
Extends NetworkBehaviour to allow room visibility and interaction to be synchronized in a networked game.
π· Public Propertiesβ
roomNameβ
Type: string
Friendly name of the room, primarily for debugging and identification.
RoomSpawnPointβ
Type: Vector3 (read-only)
Returns the position where players or objects spawn in the room.
RoomSpawnRotationβ
Type: Vector3 (read-only)
Returns the euler angles for the room's spawn rotation.
π― Camera & Spawn Controlβ
GetCameraConfiner()β
Returns: Collider
Retrieves the collider used to confine the camera within the room's bounds.
GetRoomInteriorAreaColliders()β
Returns: Collider[]
Returns the set of colliders defining the room's interaction or trigger areas.
π Room Lifecycle Methodsβ
ShowRoom()β
- Activates room structure and placement surfaces.
- Notifies the
DynamicInteriorControllerto switch to this room. - Reveals interior items matching this room's index.
HideRoom()β
- Deactivates room structure and placement surfaces.
- Hides all items associated with this room.
π§± Grid Preview Controlsβ
ShowGridPreview(GridSize gridSize, bool useWallGrid, bool useFloorGrid)β
Displays wall/floor placement grids based on the specified GridSize enum:
Small,Medium,Large.
HideGridPreview()β
Disables all wall and floor grid objects.
π§ͺ Editor Toolsβ
GatherChildPlacementSurfaces()β
- Populates
placementSurfacesarray by scanning child objects. - Logs a warning if none are found.
π§΅ Serialized Private Fieldsβ
These serialized fields support Unity Editor visualization and functionality:
roomSpawnPoint: Transform used as spawn origin.roomCameraConfiner: Collider used for camera boundaries.placementSurfaces: Usable surfaces for item placement.- Wall/floor grid objects in multiple sizes.
roomStructure: GameObjects representing the roomβs visible content.dynamicInteriorController: Reference to parent controller for state coordination.
π§ Summaryβ
The InteriorRoom script is central to managing dynamic, multiplayer-ready room environments. It handles visualization toggles, item activation, and camera controls, with tools for grid-based design workflows and editor integration.