Variable has not been assigned error

Hey.
I’m trying to shoot a light from a magic wand, and I keep getting this error when I run the game. The light still comes out but the error appears in the console.
I created a light prefab and I dragged that onto my script “Light_Spell”.
Here is the code:

using UnityEngine;
using System.Collections;

public class Light_Spell : MonoBehaviour {

	private Light wandLight;
	private bool triggerIsPressed;

    private float life = 1.0f;
    private float speed = 15.0f;
    private float timeToDie = 1.0f;

	[SerializeField]
    public Light lightProjectile;

	// Find the light object and disable it
	void Start () {
		wandLight = GameObject.Find ("WandLightSpell").light;
		wandLight.enabled = false;
		triggerIsPressed = false;
	}
	
	// Handles button presses etc
	void Update () {

		if (SixenseInput.Controllers [0].Trigger != 0) {
			triggerIsPressed = true;
			wandLight.enabled = true;
			wandLight.intensity = (float)(SixenseInput.Controllers [0].Trigger) * 3;
            wandLight.range = (float)(SixenseInput.Controllers[0].Trigger) * 5;
		}  
        else {
			triggerIsPressed = false;
            wandLight.enabled = false;
            //wandLight.intensity = 0;
            //wandLight.range = 0;
		}

		if (SixenseInput.Controllers [0].GetButtonDown (SixenseButtons.BUMPER) && triggerIsPressed == false) {
			var instantiateProjectile = Instantiate(lightProjectile, transform.position, transform.rotation) as Light;

            //instantiateProjectile.transform.TransformDirection(new Vector3(5,5,5));
		}
	}

Anybody see what I’m doing wrong here? Also the light is shooting upwards, how can I have it shoot wherever the wand is pointed at?
Thanks!

I think it’s just a matter of trying something a little too complicated, before you have more practice with Unity, and especially with coding. Maybe try something simpler first. Either another part of your project, or a simple version of this.

The line number you’ve got, 37, is a }. That probably means the code above is no longer the code you’re running. After a bit, you’ll get used to double-clicking on the errors, and what they mean.

There are a lot of examples how to use Instantiate. This one is a little long, and somewhat strange (the Start code looks for a pre-existing light, but the button code creates a new light?)

After every “private” or “public” type in var
ex.
private var Light wandLight;
public var Light lightProjectile;