I’m trying to use prefabs to instantiate a sprite for a basic shooting setup however MonoDevelop gives me the error:
“The name ‘playerShot’ does not exist in the current context”
Here is my code:
using UnityEngine;
using System.Collections;
public class PlayerControl : ShipClass
{
void Start ()
{
//useless for now
}
void Update ()
{
if (Input.GetButtonDown ("Fire2"))
{
Debug.Log ("Fire2 pressed!");
Instantiate(playerShot);
}
}
}
Where playerShot in this case is the prefab that I have created. I think I’m having trouble getting my head around how a script handles a prefab so any help on this matter would be appreciated. Thanks in advance.