Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Program()
- {
- Runtime.UpdateFrequency = UpdateFrequency.Update1;
- }
- public void Main(string argument, UpdateType updateSource)
- {
- RunScriptState();
- }
- public void RunScriptState()
- {
- if (scriptState == null) scriptState = ScriptState();
- bool moreWork = false;
- try
- {
- moreWork = scriptState.MoveNext();
- }
- catch { Echo("Error caught running script"); }
- if (!moreWork)
- {
- try
- {
- scriptState.Dispose();
- }
- catch { }
- try
- {
- scriptState = null;
- }
- catch { }
- }
- }
- public IEnumerator<bool> scriptState;
- public IEnumerator<bool> ScriptState()
- {
- //Run long tasks in here
- //Pause with 'yield return true;'
- yield return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement