Пример #1
0
        // NOTE: The boot up flow is inside the MainLoop as we want to be able to load configuration files
        // before executing any systems, however for web builds we must do such loading inside the mainloop to ensure
        // the browser doesn't hang while we wait on async work to complete
        private static void Main()
        {
            // Create main world
            m_World       = DefaultTinyWorldInitialization.InitializeWorld("main");
            m_Environment = m_World.GetOrCreateSystem <TinyEnvironment>();
            m_BootPhase   = BootPhase.Booting;

            // Setup systems
            DefaultTinyWorldInitialization.InitializeSystems(m_World);

            // Run program
            NativeLeakDetection.Mode = NativeLeakDetectionMode.Enabled;
            var windowSystem = m_World.GetExistingSystem <WindowSystem>();

            if (windowSystem != null)
            {
                windowSystem.InfiniteMainLoop(MainLoop);
            }
            else
            {
                Debug.Log("No window system found.");
            }

            // Free world and all systems/managers in it
            m_World.Dispose();
        }
Пример #2
0
 private UnityInstance()
 {
     BurstInit();
     m_World = DefaultTinyWorldInitialization.InitializeWorld("main");
     DefaultTinyWorldInitialization.InitializeSystems(m_World);
     m_BootPhase            = BootPhase.Booting;
     m_Environment          = m_World.GetOrCreateSystem <TinyEnvironment>();
     m_EntityManager        = m_World.EntityManager;
     m_SceneStreamingSystem = m_World.GetExistingSystem <SceneStreamingSystem>();
 }
Пример #3
0
        static public void Initialize(int width, int height, RenderMode renderMode = RenderMode.Auto, bool DisableSwitchRenderingSystem = false)
        {
            NativeLeakDetection.Mode = NativeLeakDetectionMode.Enabled;

            world   = DefaultTinyWorldInitialization.InitializeWorld("main");
            tinyEnv = world.TinyEnvironment();

            SetDisplaySize(width, height, renderMode);

            DefaultTinyWorldInitialization.InitializeSystems(world);

            entityManager = world.EntityManager;
            var srs = World.Active.GetExistingSystem <SwitchRenderingSystem>();

            srs.Disable = DisableSwitchRenderingSystem;
        }