Camera view check

Hi guys,

I want to make a game like antichamber. The point of this question is, if can I make a function that checks what does camera see? Like when you look in the object it’s red, but when you look out it becomes green.

Thanks LemonInGintonic