Skip to content

VisionSource

Entity with a VisionSource component reveals fog when it belongs to the Player team and is also used to detect whether any VisibilitySwitch entities are inside its vision range.

Info

VisionSourceAuthoring depends on a team assignment. TeamAuthoring is added automatically, but you still need to choose which team owns this vision source. See Team.

Warning

This component reveals fog only when assigned to Player. Do not place it on enemy units unless you want to use their vision for AI logic. See AI Vision Integration.

Overview

Type Kind Purpose
VisionSourceAuthoring MonoBehaviour Placed on a sub-scene GameObject; baked into ECS at build/enter play mode
VisionSource IComponentData The runtime ECS component used by CalculateVisionSystem

VisionSourceAuthoring (Inspector)

Add VisionSourceAuthoring to any GameObject inside a Unity sub-scene that should act as a vision source.

Property Type Default Description
Shape VisionShape Circle The geometry of the vision area: Circle, Square, or Triangle
Layer VisionLayer R Determines which fog layer this source reveals (see Vision Layers)
Position Offset Vector2 (0, 0) Local XZ offset from the entity's pivot
Rotation Offset float 0 Angle offset in degrees applied on top of the entity's world rotation
Scale Vector2 (1, 1) Width (X) and height (Z) of the vision area