Help with my Project.

Hi,

I’m studying Game Design and have been given a project to design and create a simple game. I haven’t been doing this long so I am starting this game of with the basics and then going to slowly grow it. This is what the game screen looks like at the moment:

The Script for the Exit button is complete and I have stored that in an empty game object called Manager. I also have a DisplayMoney script in the Manager which is shown below:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class DisplayMoney : MonoBehaviour
{
private float startmoney = 100f;
public Text MoneyAmount;

void Update ()
{
MoneyAmount.text = “Money £” + startmoney;
}
}

Now what I am trying to do is create another script to go into the Manager that will cause the “Add Money” button to add money to the text displayed “Money £” every time it is pressed.

Can anyone help me out?

Thanks

This might help you:

Good luck with your project :slight_smile:

public void AddMoney()
{
   startmoney+=100f;
}

Add this method then Link your add money button to this method.

Note you may need to add a delay to how often it adds money.