Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

how do I add a specified number to a string?

$
0
0
so in my game I basically have a shop that I want to use in order to fake/spoof microtranactions. In order to this, I have a button that I would like to use to increment the players currency by a specified value, in this case 50 but at the moment my script is just resetting the value to nothing. Any ideas on how to do this? ---------- using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class IAP : MonoBehaviour { public Text currencyText; public int currencyToAdd; private void Start() { currencyText.text = "Currency: " + GameManager.Instance.currency.ToString(); currencyToAdd = 0; } public void _50Currency() { currencyToAdd = 50; currencyText.text = "Currency: " + GameManager.Instance.currency.ToString() + currencyToAdd; } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>