Goto.cs 698 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.SceneManagement;
  6. using System.Runtime.InteropServices;
  7. public class Goto : MonoBehaviour
  8. {
  9. [DllImport("__Internal")]
  10. private static extern void gotoUnity(int type);
  11. public string sceneName;
  12. public int type;
  13. // Use this for initialization
  14. void Start()
  15. {
  16. GetComponent<Button>().onClick.AddListener(OnClick);
  17. }
  18. private void OnClick()
  19. {
  20. //SceneManager.LoadScene("light");//level1ΪÎÒÃÇÒªÇл»µ½µÄ³¡¾°
  21. //SceneManager.LoadScene(sceneName);
  22. gotoUnity(type);
  23. //Application.LoadLevel(sceneName);
  24. }
  25. }