Skip to main content

InteriorItemVisual

A utility MonoBehaviour used to enhance and manage visual components for interior items, specifically handling outlines for selection/interaction and material feedback for invalid placements.

public class InteriorItemVisual : MonoBehaviour

🧱 Serialized Fields​

invalidPlacementMaterialController​

Type: InvalidPlacementMaterialController
Description: Reference to the component responsible for swapping materials during invalid placement scenarios.

outline​

Type: Outlinable
Description: Reference to the EPOOutline.Outlinable component used to visually emphasize this object in the editor or during runtime.


🔧 Setup & Helpers​

Setup(InteriorItemBase item)​

Stores a reference to the associated InteriorItemBase. Used to tie this visual controller to a logical game item.

GetOutline()​

Returns the cached Outlinable component.

GetInvalidPlacementMaterialController()​

Returns the cached invalid placement controller.


🧙 Editor Utilities (Editor Only)​

These are exposed via Odin buttons in the Unity Editor:

GatherOutline()​

  • Searches for an Outlinable component in the child hierarchy.
  • Sets the outline mode to GenericMask.
  • Applies the brand's primary color from BrandColors.Primary.

GatherInvalidPlacementMaterial()​

  • Searches for an InvalidPlacementMaterialController in the child hierarchy.

Both methods mark the object as dirty to ensure Unity saves any changes made during the editor session.


🧩 Integration Notes​

Attach this component to any interior item prefab that needs:

  • Runtime togglable outlines (e.g., for selection or hover)
  • Visual feedback on placement validity (red overlay for blocked placement)

This script acts as a glue layer between gameplay logic and Unity visuals.