public static async Task<Variable> Execute(ParsingScript script) { char[] toArray = Constants.END_PARSE_ARRAY; Variable result = null; Exception exception = null; #if UNITY_EDITOR || UNITY_STANDALONE || MAIN_THREAD_CHECK // Do nothing: already on the main thread #elif __ANDROID__ scripting.Droid.MainActivity.TheView.RunOnUiThread(() => { #elif __IOS__ scripting.iOS.AppDelegate.GetCurrentController().InvokeOnMainThread(() => { #else #endif try { #if __IOS__ || __ANDROID__ result = script.Execute(toArray); #else result = await script.ExecuteAsync(toArray); #endif } catch (ParsingException exc) { exception = exc; } #if UNITY_EDITOR || UNITY_STANDALONE || MAIN_THREAD_CHECK // Do nothing: already on the main thread or main thread is not required #elif __ANDROID__ || __IOS__ }); #endif if (exception != null) { throw exception; } return result; } }