The code is giving me a null reference error and i dont understand why? The error is apparently on the 2nd line of ProjectileEquip function. been trying to figure it out for far to long.
using UnityEngine;
using System.Collections;
public class SubMenuGUI : MonoBehaviour {
public GUIStyle myGUI;
public int selGridInt = 0;
public string[] weapons = new string[] {"Plasma", "RailGun"};
private scriptPlayer scriptplayer;
void Awake(){
scriptplayer = GetComponent<scriptPlayer>();
}
void OnGUI(){
GUI.Box(new Rect(0,0,Screen.width,Screen.height),"Customize Your Ship", myGUI);
selGridInt = GUI.SelectionGrid(new Rect(25, 25, 150, 30), selGridInt, weapons, 2);
ProjectileEquip();
if(GUI.Button(new Rect(Screen.width / 2 - 50, Screen.width / 2 + 150,100, 50), "Enter World"))
Destroy(this);
}
void ProjectileEquip(){
if(selGridInt == 0){
scriptplayer.plasma = true;
}
if(selGridInt == 1)
print("RailGun");
}
}