A.cs 729 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. using TMPro;
  3. public class A : MonoBehaviour
  4. {
  5. TextMeshProUGUI text;
  6. pkpy.VM vm;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. text = GetComponent<TextMeshProUGUI>();
  11. Application.targetFrameRate = 60;
  12. try
  13. {
  14. vm = new pkpy.VM();
  15. vm.exec("a = 0");
  16. }
  17. catch (System.Exception e)
  18. {
  19. text.text = e.StackTrace.ToString() + e.GetType().ToString()+ ": " + e.Message.ToString();
  20. throw;
  21. }
  22. }
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. if(vm == null)
  27. return;
  28. vm.exec("a += 1");
  29. text.text = vm.eval("a");
  30. }
  31. }