Detect if player is facing an Object

i’m making a game where my player will change position if he is facing an object (90°) any help to make that detection ?

Hello,

I would recomment you to use Raycast:

Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 100)){
    //check if it hits desired object
    // and do some logic
}

Attach this to your player and check the results.

transform.position is your player position
transform.forward is your player forward direction

Regards,
M.Rogalski