DebugUI.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //======= Copyright (c) Valve Corporation, All rights reserved. ===============
  2. //
  3. // Purpose: Debug UI shown for the player
  4. //
  5. //=============================================================================
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. using System.Collections;
  9. namespace Valve.VR.InteractionSystem
  10. {
  11. //-------------------------------------------------------------------------
  12. public class DebugUI : MonoBehaviour
  13. {
  14. private Player player;
  15. //-------------------------------------------------
  16. static private DebugUI _instance;
  17. static public DebugUI instance
  18. {
  19. get
  20. {
  21. if ( _instance == null )
  22. {
  23. _instance = GameObject.FindObjectOfType<DebugUI>();
  24. }
  25. return _instance;
  26. }
  27. }
  28. //-------------------------------------------------
  29. void Start()
  30. {
  31. player = Player.instance;
  32. }
  33. #if !HIDE_DEBUG_UI
  34. //-------------------------------------------------
  35. private void OnGUI()
  36. {
  37. if (Debug.isDebugBuild)
  38. {
  39. player.Draw2DDebug();
  40. }
  41. }
  42. #endif
  43. }
  44. }