コード例 #1
0
        public IEnumerator ActionExecuteNextLateUpdate()
        {
            // Wait for a new frame
            yield return(new WaitForEndOfFrame());

            var counter = 0;

            UnityThread.ExecuteInUpdate(() => {
                ++counter;
                Debug.Log("Update loop");
            });
            UnityThread.ExecuteInLateUpdate(() => {
                counter = counter * 2;
                Debug.Log("LateUpdate loop");
            });

            // Runner is spawned
            var runner = GameObject.Find("UnityThreadRunner");

            Assert.NotNull(runner);

            yield return(null);

            LogAssert.Expect(LogType.Log, "Update loop");
            Assert.AreEqual(1, counter);

            yield return(new WaitForEndOfFrame());

            LogAssert.Expect(LogType.Log, "LateUpdate loop");
            Assert.AreEqual(2, counter);
        }