The Color Detector is a component that can be used to detect a specific color with tolerance.
A Color Detector analysing three cubes for a Red color. The Output Signal returns High for the red cube, and low for the green and blue cubes
The Color Detector Physical and Logic components can be found under Standard Components > Color Sensor > Color Detector.
It can also be accessed from the GameObject menu or from the Hierarchy Context menu.
A new GameObject will be created if you do not have a GameObject selected. Otherwise, the Color Detector will be added to the selected GameObject |
Live Data | |
State | Shows whether the Color Detector is currently active and thus whether it will detect a color |
Output Signal | Shows whether or not the Color Detector is currently detecting the Reference Color |
Match Percentage | The percentage with which the detected color matches the Reference Color |
Properties | |
Color Sensor | The specific Color Sensor to use for the Color Detector. By default, a |
Reference Color | The color which the detected color will be compared with |
Threshold | The minimum Match Percentage at which the Color Detector has a High Output Signal |
On Signal High | A UnityEvent that is fired as soon as the Color Detector has a High Output Signal |
On Signal Low | A UnityEvent that is fired as soon as the Color Detector has a Low Output Signal |
Control Panel | |
Generate Control Panel for ColorDetector | Click this button to generate a Control Panel for the Color Detector |
Properties | |
ColorDetector | The Phyisical Color Detector component attached to this Logic component |
PLC I/O | In the PLC I/O panel you can see the latest input and output values from the PLC |
These settings are general Logic Component settings.
Assign a Color Detector physical component to a GameObject, or create a new one directly from the menu
Select the desired settings under the Properties tab
In Play Mode, the Match Percentage of detected objects will be displayed, as well as the Output Signal