Skip to main content

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 DynamicInteriorController to 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 placementSurfaces array 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.