I’m currently having problems fixing these two errors. I understand what is causing the error but I’m not sure what i can do to stop it from doing so. Any help is appreciated.
Edit: The use of “public UnityEngine.GUIStyle style = null;” worked. No errors when I used that.
#1 Assets/Scripts/BulletFireScript.cs(39,21): error CS1502: The best overloaded method match for `UnityEngine.GUI.Label(UnityEngine.Rect, string, UnityEngine.GUIStyle)’ has some invalid arguments
#2 Assets/Scripts/BulletFireScript.cs(39,21): error CS1503: Argument #3' cannot convert
GUIStyle’ expression to type `UnityEngine.GUIStyle’
using UnityEngine;
using System.Collections;
public class BulletFireScript: MonoBehaviour {
public Transform Bullet;
int shots = 5;
int maxshots = 0;
//public Font myFont;
public Rect position = new Rect(200, 15, 150, 25);
public string text = "Ammo: ";
public GUIStyle style = null;
// Use this for initialization
void Start () {
Screen.lockCursor = true;
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown ("Fire1") && shots > maxshots) {
Instantiate (Bullet, transform.position, transform.rotation);
shots--;
}
else if(Input.GetKeyDown(KeyCode.R))
{
shots=5;
}
}
private void OnGUI(){
//GUI.skin.font = myFont;
//GUI.Label(new Rect(20,20,100,20), "TEST" + shots);
GUI.Label(position, text, style);
}
}