Update not updating numbers fast enough
I am starting to learn Unity, so I made a "Clicker" kind of game that uses the keyboard instead. My CSharp script is like this
 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections;
 
 public class Score : MonoBehaviour {
 
     public Text yourScore;
     public int score;
     public Button clickMe;
     public int counter1;
     public int purchased1;
 
     void Start () {
         score = 0;
         Debug.Log(Time.fixedDeltaTime.ToString());
     }
     void Update () {
         yourScore.text = "Money: " + score.ToString();
         if (Input.GetKeyDown(KeyCode.C))
         {
             score++;
         }
         if(score>= 100&& Input.GetKeyDown(KeyCode.K))
         {
             purchased1++;
             score = score - 100 ;
             Debug.Log(purchased1);
         }
         if (counter1 >= 500)
         {
             score++;
             counter1 = counter1 - 500;
         }
     }
     void FixedUpdate()
     {
         counter1 = counter1 + (1 * purchased1);
     }
 }
The problem is that when purchased1 is a really big number (like 1000) counter1 starts to have a "backlog" of numbers. What I mean is that counter1 will stay with ex. 35000 and will slowly start substracting the 500 and adding 1 to score. Can I make it so the process of substracting is faster? I have tried putting it in FixedUpdate and Update with no luck. Thanks in advance.
Answer by OncaLupe · Nov 28, 2015 at 10:11 PM
If I understand what you're trying to do correctly, this should help:
 while (counter1 >= 500)
 {
      score++;
      counter1 = counter1 - 500;
 }
Your answer
 
 
             Follow this Question
Related Questions
Why does NetworkServer.ReplacePlayerForConnection not recognize the instantiated object parameter? 0 Answers
I guys I have a really hard question 0 Answers
Can't Resources.Load ScriptableObject in Static class 0 Answers
How would you save anti aliasing or v-sync stuff that are like QualitySettings.antiAliasing = 2; 0 Answers
Unity 5.3 UI Button wont set Select state via script after the parent has been set inactive 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                