Screen go darker when it look at an Object?

Anyone can tall me how can i do when i look at an object the camre screen is darking (soory fo my bad english i m hun :slight_smile: ) Please tall me anyone I tootally no have any idea !

The easiest way to darken the screen is to place a black texture in front of the camera and control its alpha value - 0 is normal screen, 1 is completely dark.

If you want the darkness to be max when looking directly to the object, and gradually reduce as you look to other direction, use a dot product to calculate the alpha (camera script):

var black: Texture2D; // drag a black texture of any size here
var target: Transform; // drag the object here
var sensitivity: float = 1; // darkness sensibility to the angle

private var darkness: float = 0; 

function Update(){
  // find the object direction normalized:
  var dir = (target.position - transform.position).normalized;
  // darkness is max when looking directly to the object:
  darkness = 1 + sensitivity * (Vector3.Dot(dir, transform.forward)-1);
}

function OnGUI(){
  GUI.color.a = Mathf.Clamp(darkness, 0, 1); // set the black alpha
  GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), black);
}