Turn off LookAt

Hi,

I would would like to lock on a target with mouse down (and say turn target red) the Lookat will then allow me to shoot (lockon) to target. but if i mouse down elsewhere the lookAt should stop and the target return to original color.

Thanks

if `lookAt` is the instance of the `LookAt` script attached to your camera then setting `lookAt.enabled` to true or false will turn it on or off.

if `targetObject` is the targeted `GameObject` then you can modify it's color with

// this assumes the mesh renderer is on the same game object
targetObject.renderer.material.color = Color.red;