mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
36 lines
729 B
C#
36 lines
729 B
C#
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class A : MonoBehaviour
|
|
{
|
|
TextMeshProUGUI text;
|
|
pkpy.VM vm;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
text = GetComponent<TextMeshProUGUI>();
|
|
Application.targetFrameRate = 60;
|
|
|
|
try
|
|
{
|
|
vm = new pkpy.VM();
|
|
vm.exec("a = 0");
|
|
}
|
|
catch (System.Exception e)
|
|
{
|
|
text.text = e.StackTrace.ToString() + e.GetType().ToString()+ ": " + e.Message.ToString();
|
|
throw;
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if(vm == null)
|
|
return;
|
|
vm.exec("a += 1");
|
|
text.text = vm.eval("a");
|
|
}
|
|
}
|