Document toolboxDocument toolbox

2023.1.1571.2 Color Detector



Overview

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.


Where to find

The Color Detector Physical and Logic components can be found under Standard Components > Color Sensor > Color Detector > Add Physical Component.

It can be accessed from the GameObject menu as well as 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.


Feature layout - Physical Component

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
Color Sensor will automatically be assigned by either finding a suitable one in the scene or creating a new one.

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

Click this button to generate a ControlPanelInterface for the Color Detector.

Feature Layout - Control Panel

Title

The Title of the Control Panel.

Click to ping the target component in the hierarchy.

Double click to edit.

DCMotor Properties

 

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.

Enable/Disable

Enables/Disables the Color Detector.

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

  1. Assign a Color Detector physical component to a GameObject, or create a new one directly from the menu.

  2. Select the desired settings under the Properties tab.

  3. In Play Mode, the Match Percentage of detected objects will be displayed, as well as the Output Signal.

Prespective Documentation