- Home /
Duplicate Question
Update Guitext every frame
using javascript i wrote a scoring script accessed by other scripts, but i want to make the guitext show to counter every frame to keep an updated score. please help
var Counter : int = 0;
function addscore () {
Counter++;
guiText.text = ""+Counter;
if (Counter > 100){
guiText.anchor = TextAnchor.UpperRight;
guiText.pixelOffset = Vector2 (100,351);
}
}
function Update (){
guiText.text = ""+Counter;
}
function endlevel (){
guiText.text = "0";
Counter = 0;
}
thanks :)
What is wrong? In function Update() you update your guiText each frame.
it doesn't show the score on the guitext which is what i was wondering how to do every frame
Assu$$anonymous$$g the code above is attached to a game object, and assu$$anonymous$$g the guiText component that is displaying your Counter is on this game object, you are updating the text every frame. So select this game object while the game is running and look at the value of 'Counter'.
Answer by Hex2013 · Nov 11, 2014 at 02:59 AM
i found the problem, the function calling wasn't working
here is link if you want to help out http://answers.unity3d.com/questions/828668/calling-functions-help-javascript.html
Follow this Question
Related Questions
Animating GUI Texture - Help 4 Answers
FixedUpdate limits: consistant 0.01 s on mobile devices? 1 Answer
How to slow down large code? 1 Answer
Set guiText 1 Answer