public override IEnumerator LoadScenes([ValueSource(nameof(UnityPhysicsSamplesTest.GetScenes))] string scenePath)
        {
            // Don't create log messages about the number of trial days remaining
            PlayerPrefs.SetInt("Havok.Auth.SuppressDialogs", 1);

            // Log scene name in case Unity crashes and test results aren't written out.
            Debug.Log("Loading " + scenePath);
            LogAssert.Expect(LogType.Log, "Loading " + scenePath);

            // Ensure Havok
            var world = World.DefaultGameObjectInjectionWorld;

            var system = world.GetOrCreateSystem <EnsureHavokSystem>();

            system.Enabled = true;

            SceneManager.LoadScene(scenePath);
            yield return(new WaitForSeconds(1));

            UnityPhysicsSamplesTest.SwitchWorlds();
            yield return(new WaitForFixedUpdate());

            LogAssert.NoUnexpectedReceived();

            PlayerPrefs.DeleteKey("Havok.Auth.SuppressDialogs");
        }
        public override IEnumerator LoadScenes([ValueSource(nameof(UnityPhysicsSamplesTest.GetScenes))] string scenePath)
        {
            // Don't create log messages about the number of trial days remaining
            PlayerPrefs.SetInt("Havok.Auth.SuppressDialogs", 1);

            // Log scene name in case Unity crashes and test results aren't written out.
            Debug.Log("Loading " + scenePath);
            LogAssert.Expect(LogType.Log, "Loading " + scenePath);

            var world = World.DefaultGameObjectInjectionWorld;

            // Ensure Havok
            var system = world.GetExistingSystem <EnsureHavokPhysics>();

            {
                Assert.IsNull(system, "The 'EnsureHavokPhysics' system should only be created by the 'HavokPhysicsSamplesTest.LoadScenes' function!");

                system = new EnsureHavokPhysics();
                world.AddSystem(system);
                world.GetExistingSystem <SimulationSystemGroup>().AddSystemToUpdateList(system);
            }

            SceneManager.LoadScene(scenePath);
            yield return(new WaitForSeconds(1));

            UnityPhysicsSamplesTest.EntitiesCleanup();
            yield return(new WaitForFixedUpdate());

            world.GetExistingSystem <SimulationSystemGroup>().RemoveSystemFromUpdateList(system);
            world.DestroySystem(system);

            LogAssert.NoUnexpectedReceived();

            PlayerPrefs.DeleteKey("Havok.Auth.SuppressDialogs");
        }
Beispiel #3
0
        public override IEnumerator LoadScenes([ValueSource(nameof(UnityPhysicsSamplesTest.GetScenes))] string scenePath)
        {
            // Log scene name in case Unity crashes and test results aren't written out.
            Debug.Log("Loading " + scenePath);
            LogAssert.Expect(LogType.Log, "Loading " + scenePath);

            SceneManager.sceneLoaded += (Scene scene, LoadSceneMode mode) => SetSimulationType(SimulationType.HavokPhysics, scene, mode);
            SceneManager.LoadScene(scenePath);
            yield return(new WaitForSeconds(1));

            UnityPhysicsSamplesTest.EntitiesCleanup();
            yield return(new WaitForFixedUpdate());

            LogAssert.NoUnexpectedReceived();
        }
Beispiel #4
0
        public override IEnumerator LoadScenes([ValueSource(nameof(UnityPhysicsSamplesTest.GetScenes))] string scenePath)
        {
            // Don't create log messages about the number of trial days remaining
            PlayerPrefs.SetInt("Havok.Auth.SuppressDialogs", 1);

            // Log scene name in case Unity crashes and test results aren't written out.
            Debug.Log("Loading " + scenePath);
            LogAssert.Expect(LogType.Log, "Loading " + scenePath);

            SceneManager.sceneLoaded += (Scene scene, LoadSceneMode mode) => SetSimulationType(SimulationType.HavokPhysics, scene, mode);
            SceneManager.LoadScene(scenePath);
            yield return(new WaitForSeconds(1));

            UnityPhysicsSamplesTest.EntitiesCleanup();
            yield return(new WaitForFixedUpdate());

            LogAssert.NoUnexpectedReceived();

            PlayerPrefs.DeleteKey("Havok.Auth.SuppressDialogs");
        }