Unity 5.4.0f3 Personal - UI not updating after Build.

I’m still a complete scrub when it comes to all of this and I am having an issue with my UI once the game has been built. I’m building a Pong clone which is designed to increment a score based on which goal the game ball enters and it works fine in the editor. But as soon as I build the game and test it the UI will not update.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Score : MonoBehaviour {

	private int CurrentScore;
	private int CurrentAIScore;

	public Text PlayerText;
	public Text AIText;

	public GameObject sceneManager;

	void Update()
	{
		PlayerText.text = CurrentScore.ToString ();
		AIText.text = CurrentAIScore.ToString ();
	
	}

	void OnTriggerEnter2D(Collider2D DoesScore)
	{
		if (DoesScore.gameObject.tag == "Player" && DoesScore.gameObject.isStatic) 
		{
			CurrentScore++;
			Debug.Log ("Player Scored!");
			if (CurrentScore >= 9) 
			{
				SceneManager.LoadScene ("PlayerWins");
			} 
		}
		if (DoesScore.gameObject.tag == "AI" && DoesScore.gameObject.isStatic) 
		{
			CurrentAIScore++;
			Debug.Log ("AI Scored!");
			if (CurrentAIScore >= 9) {
				SceneManager.LoadScene ("AIWins");
			}
		}
	}
}

All tags are correctly wired up, triggers are active on the box colliders of the goals and are set to static. The score even initializes at ‘0’ for both players as it writes it in update(). I think it might have something to do with either the SceneManager or the Triggers. Im just not sure. Any help would be greatly appreciated.

You should update the texts when the score changes, not in Update, since it will be called each frame, even if the score doesn’t change.

void Awake()
     {
         PlayerText.text = "0";
         AIText.text = "0";
     }

void OnTriggerEnter2D(Collider2D DoesScore)
     {
         if (DoesScore.gameObject.tag == "Player" && DoesScore.gameObject.isStatic) 
         {
             CurrentScore++;
             PlayerText.text = CurrentScore.ToString ();
             Debug.Log ("Player Scored!");
             if (CurrentScore >= 9) 
             {
                 SceneManager.LoadScene ("PlayerWins");
             } 
         }
         if (DoesScore.gameObject.tag == "AI" && DoesScore.gameObject.isStatic) 
         {
             CurrentAIScore++;
             AIText.text = CurrentAIScore.ToString ();
             Debug.Log ("AI Scored!");
             if (CurrentAIScore >= 9) {
                 SceneManager.LoadScene ("AIWins");
             }
         }
     }

Your piece of code should work tho…

Do the triggers work properly (–> you get the Debug.Log) and only UI is affected ?