Created
March 31, 2019 04:03
-
-
Save luisartg/f4a89f684f9f988f1571ab63fe3ab2f8 to your computer and use it in GitHub Desktop.
Score Diplay loading all current sessions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using TMPro; | |
public class ScoreDisplay : MonoBehaviour | |
{ | |
[SerializeField] TextMeshProUGUI scoreText = null; | |
[SerializeField] GameSession gameSession = null; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
scoreText = GetComponent<TextMeshProUGUI>(); | |
var gameSessions = FindObjectsOfType<GameSession>(); | |
Debug.Log("Found " + gameSessions.Length.ToString() + " sessions!"); | |
gameSession = gameSessions[0]; | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
scoreText.text = gameSession.GetScore().ToString(); | |
Debug.Log("Displaying " + gameSession.GetScore().ToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment