Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Why are systems not being added to my world!

Discussion in 'Entity Component System' started by officialfonee, Sep 26, 2020.

  1. officialfonee

    officialfonee

    Joined:
    May 22, 2018
    Posts:
    42
    After much google searching, the only forums I could find were from 2018 when the way to create and add systems to worlds were different! I am not sure If I am doing something wrong but no systems are added to my world!
    Code (CSharp):
    1.  private void Awake()
    2.     {
    3.  
    4.         cellSimulationWorld = new CellSimulationWorld("Cell Simulation World");
    5.  
    6.         cellSimulationWorld.GetOrCreateSystem<UpdateWorldTimeSystem>();
    7.  
    8.         World.DefaultGameObjectInjectionWorld = cellSimulationWorld;
    9.  
    10.         //Start Systems
    11.         var initializationSystemGroup = cellSimulationWorld.GetOrCreateSystem<InitializationSystemGroup>();
    12.  
    13.         initializationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<BeginInitializationEntityCommandBufferSystem>());
    14.         initializationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<EndInitializationEntityCommandBufferSystem>());
    15.  
    16.         //update
    17.         var simulationSystemGroup = cellSimulationWorld.GetOrCreateSystem<SimulationSystemGroup>();
    18.  
    19.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<CellBoundsSystem>());
    20.  
    21.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<CellBoundsSystem>());
    22.  
    23.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<CellVelocitySystem>());
    24.  
    25.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<CellHungerSystem>());
    26.  
    27.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<CellPropertiesSystem>());
    28.  
    29.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<CellStateSystem>());
    30.  
    31.         simulationSystemGroup.AddSystemToUpdateList(cellSimulationWorld.GetOrCreateSystem<NeuralNetworkSystem>());
    32.  
    33.         //Late update / rendering
    34.         var presentationSystemGroup = cellSimulationWorld.GetOrCreateSystem<PresentationSystemGroup>();
    35.  
    36.         initializationSystemGroup.SortSystems();
    37.         simulationSystemGroup.SortSystems();
    38.         presentationSystemGroup.SortSystems();
    39. }
    CellSimulationWorlds is just a class that is derived from World.

    When I play, the world looks like this:
     

    Attached Files:

    yiyu_1989 likes this.
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,674
    from memory, add this to the end

    ScriptBehaviourUpdateOrder.AddWorldToCurrentPlayerLoop(cellSimulationWorld);
     
  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,695
  4. officialfonee

    officialfonee

    Joined:
    May 22, 2018
    Posts:
    42
    THANK YOU SO MUCH! The method was changed to ScriptBehaviourUpdateOrder.UpdatePlayerLoop