Hello! So I am currently trying to create a little weapon shop for a personal project I am working on and I am having a lot of trouble that 45 min of Google could not solve.
The biggest problem so far is that Unity is not registering the ‘UI’ class and I can not figure out why. Here is the current script that I have:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.Events;
public class Master : MonoBehaviour {
public Button store;
public UI.Button.ButtonClickedEvent onClick;
public Transform hands;
public GameObject gun1;
// Use this for initialization
void Start () {
store = GetComponent<Button>();
gun1 = GameObject.FindGameObjectWithTag("Weapon1");
hands = GameObject.FindGameObjectWithTag("Player").transform;
onClick = Instantiate(gun1, hands.position, hands.rotation);
}
// Update is called once per frame
void Update () {
store.onClick;
}
}
The exact errors I get are: Severity Code Description Project File Line
Error CS0246 The type or namespace name ‘UI’ could not be found (are you missing a using directive or an assembly reference?) TDS-AYYYY.CSharp C:\Users\Gavin\Documents\TDS-AYYYY\Assets\Scripts\Master.cs 9
(Line 9 is public UI.Button.ButtonClickedEvent onClick;)
And
Severity Code Description Project File Line
Error CS0201 Only assignment, call, increment, decrement, and new object expressions can be used as a statement TDS-AYYYY.CSharp C:\Users\Gavin\Documents\TDS-AYYYY\Assets\Scripts\Master.cs 23
(Line 23 is store.onClick)