Question by
zak666 · Jan 22, 2016 at 07:19 PM ·
scriptingbasics
Assets/Scripting/ClassicGameController.cs(14,36): error CS1525: Unexpected symbol `:' "GUI TEXT STUFF"
very simple, float to guitext, dont know whats going on here think the C# fatuige is getting to me. :D using UnityEngine; using System.Collections; using UnityEngine.UI;
public class ClassicGameController : MonoBehaviour
{
public static float EarthLife = 1000;
public GUIText EarthLifeText;
public void update()
{
EarthLifeText.Text : "" + EarthLife; //set LP of Earth.
}
}
Comment
Best Answer
Answer by gjf · Jan 22, 2016 at 07:43 PM
in future, please format ALL of your code.
2 problems here - one of which is obvious and if the line numbers match up (which is why formatting is important!) then you'd see it was on this line:
EarthLifeText.Text : "" + EarthLife;
:
? you mean =
, right?
however, it's not a great idea to do this here - better to do it wherever EarthLife
changes - setting it every frame is going to slow things down a little...
the other is your function name - unity automatically calls Update()
but not update()
. pay attention to the case ;)
Your answer
![](https://koobas.hobune.stream/wayback/20220612061250im_/https://answers.unity.com/themes/thub/images/avi.jpg)