# Ray Handler

![This laser beam is controlled by a Ray handler script](https://4289778471-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVKw8MgRKSYbFzCqlnm%2F-MW59D3qOHVhA2iPKw1D%2F-MW597xcBaaBpt__ncaf%2Fray%20illustration.PNG?alt=media\&token=a7ecf2fb-8a8f-45d2-8d58-9493ada84d8b)

This component controls a [Line renderer](https://docs.unity3d.com/Manual/class-LineRenderer.html) to work as a laser. It uses a [Physics Raycaster](https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-PhysicsRaycaster.html) to determine if the laser hits something. Resizes the line renderer to match the raycast result.

Note: Rays can be only controlled by a Ray Handler.

* **Play On Awake:** activates the effect on awake.
* **Delay:** how long (in seconds) before the laser becomes visible after activation.
* **Line Renderer:** Line renderer that represents the laser.
* **Spark Particle:** A particle that appears at the end of the laser where it hits something.
* **Max Distance:** How far can the laser extends.
* **Obstacle Layer Mask:** You can ignore certain layers that do not interrupt the laser beam.

![](https://4289778471-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVKw8MgRKSYbFzCqlnm%2F-MVv4Yx2p0KBh5nP4n8z%2F-MVvGvfp9-Z0DyNfOKsb%2Fray%20handler.PNG?alt=media\&token=b1721242-ec7e-4e0d-8e18-76eef48e6a64)
