Beispiel #1
0
        IEnumerator WaitUntilBuildFinishes(BuildReport report)
        {
            /* [NOTE] You might want to use a frame wait instead of a time based one:
             * Building is main thread, and we won't get a frame update until the build is complete.
             * So that would almost certainly wait until right after the build is done and next frame tick,
             * reducing the likely hood of data being unloaded / unavaliable due to
             * cleanup operations which could happen to the build report as variables on the stack are not counted as "in use" for the GC system
             */
            EditorWaitForSeconds waitForSeconds = new EditorWaitForSeconds(1f);

            while (BuildPipeline.isBuildingPlayer)
            {
                yield return(waitForSeconds);
            }

            AnalyticsHelper.BuildCompleted(report.summary.result, report.summary.totalTime);
            switch (report.summary.result)
            {
            case BuildResult.Cancelled: Debug.LogWarning("[Version and Build] Build cancelled! " + report.summary.totalTime); break;

            case BuildResult.Failed: Debug.LogError("[Version and Build] Build failed! " + report.summary.totalTime); break;

            case BuildResult.Succeeded: Debug.Log("[Version and Build] Build succeeded! " + report.summary.totalTime); break;

            case BuildResult.Unknown: Debug.Log("[Version and Build] Unknown build result! " + report.summary.totalTime); break;
            }
        }
        private static IEnumerator RefreshProcessingProgress(float refreshDelay, Store <AppState> store)
        {
            EditorWaitForSeconds waitAmount = new EditorWaitForSeconds(refreshDelay);

            yield return(waitAmount);

            store.Dispatch(new QueryProgressAction());
        }
Beispiel #3
0
        static IEnumerator UpdateARKitDefinesCoroutine()
        {
            var waitObj = new EditorWaitForSeconds(.25f);

            while (true)
            {
                UpdateARKitDefines();
                yield return(waitObj);
            }
        }
Beispiel #4
0
    // Coroutine that handles the autosave execution
    static IEnumerator SaveOpenScenesCoroutine()
    {
        int interval    = saveInterval * 60;
        var waitForSave = new EditorWaitForSeconds(interval);

        while (true)
        {
            if (autoSaveEnabled && !Application.isPlaying)
            {
                SaveAllOpenScenes();
            }

            yield return(waitForSave);
        }
    }
        private static IEnumerator WaitUntilUserLogsIn(float refreshDelay, Store <AppState> store)
        {
            EditorWaitForSeconds waitAmount = new EditorWaitForSeconds(refreshDelay);

            while (EditorWindow.HasOpenInstances <ShareWindow>())
            {
                yield return(waitAmount); //Debug.LogError("Rechecking login in " + refreshDelay);

                if (UnityConnectSession.instance.GetAccessToken().Length != 0)
                {
                    store.Dispatch(new LoginAction()); //Debug.LogError("Connected!");
                    waitUntilUserLogsInRoutine = null;
                    yield break;
                }
            }
            waitUntilUserLogsInRoutine = null; //Debug.LogError("Window closed");
        }
        private static IEnumerator UpdateProgress(Store <AppState> store, UnityWebRequest request)
        {
            EditorWaitForSeconds waitForSeconds = new EditorWaitForSeconds(0.5f);

            while (true)
            {
                if (request.isDone)
                {
                    break;
                }

                int progress = (int)(Mathf.Clamp(request.uploadProgress, 0, 1) * 100);
                store.Dispatch(new UploadProgressAction {
                    progress = progress
                });
                yield return(waitForSeconds);
            }
            yield return(null);
        }
Beispiel #7
0
        private IEnumerator IntervalCoroutine(Action callback, float interval, int handle)
        {
#if UNITY_EDITOR && REACT_EDITOR_COROUTINES
            var br = new EditorWaitForSeconds(interval);
#endif

            while (true)
            {
#if UNITY_EDITOR && REACT_EDITOR_COROUTINES
                yield return(br);
#else
                yield return(null);
#endif
                if (!ToStop.Contains(handle))
                {
                    callback();
                }
                else
                {
                    break;
                }
            }
        }