fork download
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class TextUI : MonoBehaviour
  7. {
  8. public Text playerOneScore, playerTwoScore, winMessage;
  9. public Ball ball;
  10.  
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. ball = FindObjectOfType<Ball>();
  15. Debug.Log(ball.winner);
  16.  
  17. }
  18.  
  19. // Update is called once per frame
  20. void Update()
  21. {
  22. if(Time.timeScale == 0)
  23. {
  24. switch (ball.winner)
  25. {
  26. case "Player 1":
  27. playerOneScore.text = playerOneScore.ToString();
  28. Debug.Log("Its worked 1");
  29. break;
  30. case "Player 2":
  31. playerTwoScore.text = playerTwoScore.ToString();
  32. Debug.Log("Its worked 2");
  33. break;
  34. default: break;
  35.  
  36. }
  37. }
  38.  
  39. }
  40. }
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(4,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(6,23): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?
prog.cs(8,12): error CS0246: The type or namespace name `Text' could not be found. Are you missing an assembly reference?
prog.cs(9,12): error CS0246: The type or namespace name `Ball' could not be found. Are you missing an assembly reference?
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty