how do i detect if player is looking on something?

For example, if is player looking on button. Something with raycast from camera?

That OnMouseOver will probably work as PeteZa94 suggested, but I’d personally prefer Ray casting.

Depends on the type of game you’re making, but you could try to use the OnMouseOver function.

void OnMouseOver(){
         Debug.Log("The player is looking at " +;

If you attach this script to an object, it will print out it’s name when your mouse is over it.

Use RayCast Hit!

wiki: Unity - Scripting API: RaycastHit

tuto: How to Raycast in Unity: Easy Beginner Tutorial - YouTube (i’m not the owner of the tuto)