Hello, I am relatively new to scripting and I would like to know how I would go about making a laser beam.

Everything i found was about a laser beam shooting, I am looking for a weapon mounted laser that can be toggled on and off.

There should be an example in “Angry Bots” full project available for free on the assets store.

You can use a line renderer:

var showLaser = true;
var c1 : Color = Color.yellow;
var c2 : Color = Color.red;
var lineRenderer : LineRenderer; 
function Start() {
     lineRenderer = gameObject.AddComponent(LineRenderer);
     lineRenderer.material = new Material (Shader.Find("Particles/Additive"));
     lineRenderer.SetColors(c1, c2);

function Update() {
    var hit : RaycastHit;
    var forwardPos : Vector3 = transform.position +(transform.forward * 1000);
    forwardPos = hit.point;
    lineRenderer.SetPosition(0, transform.position);
    lineRenderer.SetPosition(1, forwardPos);

this script can be attached to your weapon as an example… toggle “showLaser” on and off through code to show/hide the laser
(I added a raycast to check for objects in the path of the laser, to shorten it if necessary)

This is a complicated aspect, but can be created simply by using a script with the GetButtonDown method. Here is one I just wrote now:

Create a new C# script and call it “beam”. Add this inside it:

using UnityEngine;
using System.Collections;

public class beam : MonoBehaviour {
	public GameObject beamParticleFX;
	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
	void InstantiationMethod() {
		if(Input.GetButtonDown("Fire1")) {

That will work the instantiation and duplication part. Attach it to your player/weapon model, or anything that is supposed to fire upon left-clicking. Now all you need to do is find a suitable beam particle effect and assign it to the “Beam Particle FX” part in the Inspector window. I suggest scavenging here:

Or here if there is no result:

Hope that helps! Anything you need help with, just post me a comment, and I will be back in a couple of hours hopefully… Happy to help!