using UnityEngine;
using System.Collections;
private const int ORDERS_BAR_WIDTH = 150, RESOURCE_BAR_HEIGHT = 40;
private Player player;
public class HUD : MonoBehaviour {
public GUISkin resourceSkin, ordersSkin;}
// Use this for initialization
void Start () {
player = transform.root.GetComponent<Player>();
}
1 Answer
1
Your variable initialisation in line 3 have to be moved inside the class HUD (and the Start function probably too)
using UnityEngine;
using System.Collections;
public class HUD : MonoBehaviour
{
private const int ORDERS_BAR_WIDTH = 150, RESOURCE_BAR_HEIGHT = 40; private Player player;
public GUISkin resourceSkin, ordersSkin;
// Use this for initialization
void Start()
{
player = transform.root.GetComponent<Player>();
}
}
Your variable initialisation in line 3 have to be moved inside the class HUD (and the Start function probably too) using UnityEngine; using System.Collections; public class HUD : MonoBehaviour { private const int ORDERS_BAR_WIDTH = 150, RESOURCE_BAR_HEIGHT = 40; private Player player; public GUISkin resourceSkin, ordersSkin; // Use this for initialization void Start() { player = transform.root.GetComponent<Player>(); } }
– fffMalzbier