2023.1.1571.2 Proximity Sensor
Overview
A ProximitySensor is a component that can detect objects in a specified detection field. At least one trigger collider needs to be assigned to function as the detection field for the ProximitySensor.
A Trigger Collider does not have to be on the same GameObject as the ProximitySensor.
Where to find
The Proximity Sensor can be found under Standard Components >Proximity Sensor > Add Physical component.
This will add the Proximity Sensor component to the currently selected object or create a new empty GameObject with the component attached if no objects are selected.
Feature layout - Physical Component
Live Data |
|
State | Shows whether the sensor is currently active. |
Output Signal | Low when no object is detected. High when at least one object is detected. |
Detected Objects (n) | The number of objects detected within all the Triggers. |
Properties |
|
On Signal High() | Actions executed when Output Signal is set to high. |
On Signal Low() | Actions executed when Output Signal is set to low. |
Triggers (n) | The detection field of the Proximity Sensor. |
Generate Rigidbodies | When checked creates Rigidbodies on the trigger objects when you enter play mode. |
Control Panel |
|
Generate Control Panel | Creates a Control Panel Interface for the Proximity Sensor. |
Feature layout - Control Panel
Title | The Title of the Control Panel. Click to ping the target component in the hierarchy. Double click to edit. |
Proximity Sensor Properties |
|
State | Shows whether the Color Sensor is currently active and thus whether it will detect colors. |
Output Signal | Shows what color the ColorSensor currently detects. If no color is detected, it will return its Void Color. |
Enable/Disable | Enables/Disables the Color Sensor. |
Target Component |
|
Target Gameobject | The gameobject which has a standardcomponent you want the Control Panel for. |
Target Component | The Component which for which a Control Panel is generated. |
How to use
Create the Colliders to use as the Proximity Sensor’s detection space and set them to be triggers.
Add the trigger colliders as
Triggers.
Add an action to the
Proximity Sensor.
Test if the actions are activated in runtime.
Prespective Documentation