OverlayWebViewExample.cs 800 B

123456789101112131415161718192021222324252627282930313233
  1. using UnityEngine;
  2. namespace NRKernal.Experimental.NRExamples
  3. {
  4. public class OverlayWebViewExample : MonoBehaviour
  5. {
  6. [SerializeField] WebOverlayItem m_OverlayPrefab;
  7. private WebOverlayItem m_CurrentItem = null;
  8. void Awake()
  9. {
  10. m_OverlayPrefab.gameObject.SetActive(false);
  11. }
  12. void Start()
  13. {
  14. Load();
  15. }
  16. public void Load()
  17. {
  18. if (m_CurrentItem != null)
  19. {
  20. m_CurrentItem.Close();
  21. m_CurrentItem = null;
  22. }
  23. m_CurrentItem = GameObject.Instantiate(m_OverlayPrefab, transform);
  24. m_CurrentItem.Reset(WebOverlayItem.WebState.Normal);
  25. m_CurrentItem.gameObject.SetActive(true);
  26. }
  27. }
  28. }