Colour Detection System

Hey all! I did some searching and found nothing but basically I am wondering if there is anyway to make an action happen if a certain colour is detected?

For example, a camera facing a blank wall, and if a green coloured object appears it prints “Green”.
If a blue object shows it prints “Blue”?

Another wording would it can recognise different colours. I know this is coming close to artificial intelligence but is there anyway to code it easily, if not just say :slight_smile: thank you!

The simplest way would be to make tags for different colors, and apply the appropriate tags to various objects. Then use raycasting, and check the tag of any object the raycast hits.

You could identify the colors with the materials assigned. A simple trace from the camera in the viewing direction would hit the object and you can easily find out (material name, maybe, but a tag would be better) if it’s “red” or “blue”.

A limited strategy, as every model would have only one color. But, depending on the project, it could be sufficient.