I have a canvas where I am showing a strength points. On every exercise you do your strength gets bigger.
But sometimes I am adding to strength value like 0.3777753. After some of this operations my strength points are invsible. I want it to show only numbers with one number after comma. Like 5.6 not like 5.651234.
It looks like that:
And after some operations my value disappears
Code of the text changer looks like this;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class siła : MonoBehaviour
{
public static double sila=1;
Text text; // Reference to the Text component.
void Awake ()
{
// Set up the reference.
text = GetComponent <Text> ();
// Reset the score.;
}
void Update ()
{
text.text = "Strength " + sila;
}
}
I am increasing strength with this buttons