Question by 
               sandvic10 · Jul 24, 2017 at 04:21 PM · 
                erroreditorbuildeditor-scriptingbuild-error  
              
 
              Score counting works in editor but not when I build it!
 **I have the same problem with two of my projects, this piece of code works in editor but when i build it, it doesn't count my score! I can't figure this out. Help?
 **using UnityEngine;
     using UnityEngine.UI;
     
     public class ScoreManager : MonoBehaviour
     {
         public Text scoreText;
         public Text highScoreText;
     
         [SerializeField]
         private int score = 0;
         public int highScoreCount;
     
         // Use this for initialization
         void Start()
         {
             highScoreCount = PlayerPrefs.GetInt("HighScoreCountLocal", highScoreCount);
         }
     
         // Update is called once per frame
         void Update()
         {
             score = FindObjectOfType<TriggerScore>().score;
     
             scoreText.text = "Score: " + (score).ToString();  //doesn't work on build
     
             if (highScoreCount < (score))
             {
                 highScoreCount = (score);
             }
     
             highScoreText.text = "High Score: " + (highScoreCount).ToString();
             PlayerPrefs.SetInt("HighScoreCountLocal", highScoreCount);
         }
     }**
 
               
               Comment
              
 
               
              Your answer