Quantcast
Channel: Answers by "ThePersister"
Viewing all articles
Browse latest Browse all 99

Answer by ThePersister

$
0
0
**UPDATE** Hey @Furcifer-bellator. I've updated the script and added a unity package for you. To update the Text component, you Have to set textComponent.text = totalAttributePoints every time you change it it does not change automatically, there are ways to do that, but I'll just stick to your pattern. Here's a little package containing an example scene and the script. https://www.dropbox.com/s/acnfmb5sf8sfapx/PlusMinusSystem.unitypackage?dl=0 Note that I changed the title to "TotalAttributePoints", instead of "TotalAttributPoints", it was bothering me, haha. We now update the variable as well as the text every time we change it through our events. Note that I'm using clamp and a "Max" variable to prevent our value from going out of preferred bounds. I hope that helps, best of luck!!! If it did, please accept my answer, it would mean a lot to me :) using UnityEngine; using System.Collections; using UnityEngine.UI; public class TotalAttributePoints : MonoBehaviour { public int totalAttributePointsCurrent = 0; public int totalAttributePointsMax = 3; // Example value public Button plusbutton; public Button minusbutton; public Text totalAttributePointCounterText; void Start() { Debug.Log( "Total attribute points at start: " + totalAttributePointsCurrent ); updateText(); // You don't have to use GetComponent

Viewing all articles
Browse latest Browse all 99

Trending Articles



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