コード例 #1
0
    public bool Initialize(string defaultWorldName)
    {
        var world = new LatiosWorld(defaultWorldName);

        World.DefaultGameObjectInjectionWorld = world;

        var initializationSystemGroup = world.GetExistingSystem <InitializationSystemGroup>();
        var simulationSystemGroup     = world.GetExistingSystem <SimulationSystemGroup>();
        var presentationSystemGroup   = world.GetExistingSystem <PresentationSystemGroup>();
        var systems = new List <Type>(DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default));

        systems.RemoveSwapBack(typeof(InitializationSystemGroup));
        systems.RemoveSwapBack(typeof(SimulationSystemGroup));
        systems.RemoveSwapBack(typeof(PresentationSystemGroup));

        BootstrapTools.InjectUnitySystems(systems, world, simulationSystemGroup);
        BootstrapTools.InjectRootSuperSystems(systems, world, simulationSystemGroup);

        initializationSystemGroup.SortSystems();
        simulationSystemGroup.SortSystems();
        presentationSystemGroup.SortSystems();

        BootstrapTools.UpdatePlayerLoopWithDelayedSimulation(world);
        return(true);
    }
コード例 #2
0
    public bool Initialize(string defaultWorldName)
    {
        var world = new LatiosWorld(defaultWorldName);

        World.DefaultGameObjectInjectionWorld = world;

        var initializationSystemGroup = world.GetExistingSystem <InitializationSystemGroup>();
        var simulationSystemGroup     = world.GetExistingSystem <SimulationSystemGroup>();
        var presentationSystemGroup   = world.GetExistingSystem <PresentationSystemGroup>();
        var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);

        systems.RemoveSwapBack(typeof(InitializationSystemGroup));
        systems.RemoveSwapBack(typeof(SimulationSystemGroup));
        systems.RemoveSwapBack(typeof(PresentationSystemGroup));

        BootstrapTools.InjectSystemsFromNamespace(systems, "Unity", world, simulationSystemGroup);
        BootstrapTools.InjectRootSuperSystems(systems, world, simulationSystemGroup);

        initializationSystemGroup.SortSystemUpdateList();
        simulationSystemGroup.SortSystemUpdateList();
        presentationSystemGroup.SortSystemUpdateList();

        ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world);
        return(true);
    }
コード例 #3
0
ファイル: LsssBootstrap.cs プロジェクト: staebal/lsss-wip
    public bool Initialize(string defaultWorldName)
    {
        var world = new LatiosWorld(defaultWorldName);

        World.DefaultGameObjectInjectionWorld = world;
        world.useExplicitSystemOrdering       = true;

        var initializationSystemGroup = world.initializationSystemGroup;
        var simulationSystemGroup     = world.simulationSystemGroup;
        var presentationSystemGroup   = world.presentationSystemGroup;
        var systems = new List <Type>(DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default));

        systems.RemoveSwapBack(typeof(LatiosInitializationSystemGroup));
        systems.RemoveSwapBack(typeof(LatiosSimulationSystemGroup));
        systems.RemoveSwapBack(typeof(LatiosPresentationSystemGroup));
        systems.RemoveSwapBack(typeof(InitializationSystemGroup));
        systems.RemoveSwapBack(typeof(SimulationSystemGroup));
        systems.RemoveSwapBack(typeof(PresentationSystemGroup));

        BootstrapTools.InjectUnitySystems(systems, world, simulationSystemGroup);
        BootstrapTools.InjectRootSuperSystems(systems, world, simulationSystemGroup);

        initializationSystemGroup.SortSystems();
        simulationSystemGroup.SortSystems();
        presentationSystemGroup.SortSystems();

        //Reset playerloop so we don't infinitely add systems.
        PlayerLoop.SetPlayerLoop(PlayerLoop.GetDefaultPlayerLoop());
        var beforeGpuProfiling = world.CreateSystem <Lsss.Tools.BeginGpuWaitProfilingSystem>();
        var afterGpuProfiling  = world.CreateSystem <Lsss.Tools.EndGpuWaitProfilingSystem>();

        BootstrapTools.AddWorldToCurrentPlayerLoopWithDelayedSimulation(world);
        var loop = PlayerLoop.GetCurrentPlayerLoop();

#if UNITY_EDITOR
        ScriptBehaviourUpdateOrder.AppendSystemToPlayerLoopList(beforeGpuProfiling, ref loop, typeof(PostLateUpdate));
#else
        ScriptBehaviourUpdateOrder.AppendSystemToPlayerLoopList(beforeGpuProfiling, ref loop, typeof(UnityEngine.PlayerLoop.PostLateUpdate.PlayerEmitCanvasGeometry));
#endif

        PlayerLoop.SetPlayerLoop(loop);
        return(true);
    }