ok. i tried to figure it out on my own. it looks like this now:
using UnityEngine;
using System.Collections;
public class CashView : MonoBehaviour {
public UILabel resourceLabel;
//private int displayedResources;
private SpawnController m_spawnController = null;
void Awake()
{
m_spawnController = GameObject.FindWithTag("SpawnController").GetComponent<SpawnController>();
}
public void UpdateResource(bool instant = false) {
resourceLabel.text = "CASH: " + m_spawnController.m_playerCashh();
}
}
but i get the error:
CashView.cs(17,64): error CS1955: The member `SpawnController.m_playerCash' cannot be used as method or delegate
btw here is the full old script:
using UnityEngine;
using System.Collections;
public class CashViewOld : MonoBehaviour
{
private SpawnController m_spawnController = null;
void Awake()
{
m_spawnController = GameObject.FindWithTag("SpawnController").GetComponent<SpawnController>();
}
void OnGUI()
{
Vector2 buttonSize
= new Vector2
(120,
40); Rect startPosTop
= new Rect
(90,
30, buttonSize
.x, buttonSize
.y);
GUI
.Label(new Rect
(startPosTop
.x + 80
.0f, startPosTop
.y - 25
.0f, 100
.0f, 30
.0f
),
"CASH: " + m_spawnController
.m_playerCash); }
}