Sensors Component
The Sensors component is used to sense game objects by casting a bunch of raycasts in parallel. It utilizes the Jobs system and Burst compilation for the best efficiency possible.

Due to how the sensors count is implemented in code, you SHOULD NOT change the sensors count property during runtime. Doing so will result in a bunch of errors.
Configuring the Scanning

The scanning category has a bunch of configuration options that control how the sensors should behave, and whether they are static or dynamic.
Scan Methods
Scan method is the main option responsible for the behavior of the sensors. There are two categories of scan methods: static (which is the static scan method) and dynamic (which are the rest of the methods).
Static Scan Method
The default one is the static scan method, which means that the sensors cast are stationary and there is no dynamic movement involved.


Vertical Scan Method

The vertical scan method is used to dynamically move the sensors during runtime in a vertical motion. Useful for when you want to cover large vertical areas with just a few sensors.
The scan angle amplitude property tells the system how much the sensors move up and down.
The scan angle frequency property tells the system how fast it moves up and down.

Horizontal Scan Method

The horizontal scan method is used to dynamically move the sensors during runtime in a horizontal motion. Useful for when you want to cover large horizontal areas with just a few sensors.
The scan angle amplitude property tells the system how much the sensors move left and right.
The scan angle frequency property tells the system how fast it moves left and right.

Random Scan Method

The random scan method moves the sensors by a random value up, down, left or right, depending on the configuration.
The random scan type property defines whether the random movement is horizontal – left and right, or vertical – up and down.
The horizontal or vertical randomization property (depends on the random scan type) defines what is the maximum amount that the sensors can move randomly in the configured direction.

Sensors Orientation
The sensors orientation property controls whether the sensors should be laid out vertically, horizontally or in both directions, depending on the use case. This property is available for every scan method.
Configuring the Sensors

The sensors can be configured in the Sensors category, which contains the sensors count, sensors angle and sensors range properties.
Sensors Count – Sets the amount of sensors that should be cast from the game object.
Sensors Angle – Sets the spread angle of the sensors in degrees that should be cast from the game object.
Sensors Range – Sets the maximum allowed range in meters that the sensors can travel.
Configuring the Sensors ID

The Sensors component detects only those receivers that have the same ID as the Sensors Receiver component. By default, every Sensors and Sensors Receiver component has the same ID, which is 0. This means that every Sensors component detects every Sensors Receiver component. To change this, you can modify the Sensors ID property so that only certain sensors detect certain receivers.
Debugging the Sensors

There are two options available for debugging that provide a visualization of the sensors in action.
Show Sensors – Shows the sensors being cast from the game object during runtime.
Show Sensor Hits – Turns on color coding. Sensors that do not detect any game objects are shown in green, indicating a clear path, while sensors that register a hit, meaning they have detected a game object, are displayed in red.
Last updated