Search Unity

Bug (IN-25763) [1.0.0-pre.44] Baker to client world and server world not working properly

Discussion in 'NetCode for ECS' started by optimise, Nov 26, 2022.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Previously Baker at 1.0.0-exp.13 is working nicely but Baker without platform package at 1.0.0-pre.15 starts to not working properly anymore that it only goes through NetcodeConversionTarget.ClientAndServer path and no longer goes through NetcodeConversionTarget.Client and NetcodeConversionTarget.Server path anymore which break my authoring baker.
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    How's the progress? Will it fixed at next release?
     
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni Are u able to reproduce the bug with the repo project I shared to u last year?
     
  5. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    Hey! It is on our radar and we will try to fix ASAP. Of course I could repro it. The logic has been already changed in 1.0-pre.15, so that problem specifically is gone. But we have others.
     
    optimise likes this.
  6. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Just let u know at 1.0.0-pre.44 release it's further regress that even NetcodeConversionTarget.ClientAndServer now is not working anymore. You can reproduce it with the same repo I provided.
     
  7. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    I'm actually surprised. We have that specific issue fixed in 1.0-pre.44 and we tested that client and client server build get the correct values from the GetNetcodeTarget function.
     
  8. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    I tested in your project and the value I get from the GetNetcodeTarget is exactly what I expect in the editor. It depends from the DotsSettings current configuration.
    You are not using platform, as such the only thing that affect in the editor the GetNetcodeTargent (at baking time) are the DotsSettings setup by the baker when it creates the baking settings.

    And since runtime baking is not supported anymore baking only occurs in the editor. Let's clarify how it work, because there may be a misunderstand here.

    The SubSceneImporter use the DotsGlobalSettings and try to find, base on the GUID passed the BuildConfiguration (hash128) with setting should be applied. In case the BuildConfiguration field is not assigned or is assigned to an unknown configuration, the current default for the DotsGlobalSettings.GetPlayerType() is used. Either NetcodeClientSettings or NetcodeServerSettings. The first one then, can let you choose which configuration you want (client-only, client/server) for the client world.

    In the editor, the sub-scene are baked:
    - LiveConversoin
    - When entering playmode
    - Making a build

    LiveConversion use pretty much the default DotsGlobalSettings (the BuildConfiguration should be not set).

    When entering playmode, netcode has two systems:
    - ConfigureServerGUIDSystem
    - ConfigureClientGUIDSystem

    They are executed only in the editor and they setup the SceneSystem.BuildConfiguration to use for the baking for the server and client world respectively.

    The first time you enter playmode, or if there is a change that invalidate the bake, scenes are baked again, once for each world (an entry in SceneDependencyCache is what trigger that, via one of the Asset Worker processes).

    At this point, the baking settings are constructed and the GetNetcodeTargent will retrieve the settings to use for the current temporary baking world.

    The GetNetcodeTarget(bool isPrefab) accept a bool params that is in practice never used (apart tests) because the DotsSettings is always present.

    Now, which part of that does not work? Because I tried my self, in your project and the settings are passed as expected in the editor.

    NOTE:
    I think there is still an issue (not netcode specific) that sometime the asset processor does not get the correct up-to-date value of the setting.
     
  9. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    As a final note, in you project you have this system:

    Code (csharp):
    1.  
    2. [WorldSystemFilter(WorldSystemFilterFlags.Editor)]
    3. [UpdateInGroup(typeof(InitializationSystemGroup))]
    4. [AlwaysSynchronizeSystem]
    5. public partial class ConfigureEditorSystem : SystemBase
    6. {
    7.     protected override void OnCreate() { }
    8.    
    9.     protected override void OnUpdate()
    10.     {
    11.         if (UnityEditor.EditorApplication.isPlaying)
    12.             return;
    13.        ...        
    14.         sceneSystemGuid.BuildConfigurationGUID = DotsGlobalSettings.Instance.GetClientGUID(); // <----
    15.        ....      
    16.         Enabled = false;
    17.     }
    18. }
    19.  
    This is forcing in the editor all the Live Conversion (and only these) to be Client only (so no client-server).
     
  10. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Oh so this editor system is no longer required? And also anything else I have wrong setup?
     
    Last edited: Feb 20, 2023
  11. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    I need to check again. But I wanted to understand first why you say it does not work as expected.
     
  12. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Alright sorry my bad. I just push the changes that able to reproduce the bug. Basically it's just change line 49 back to line 48. Then when u enter mode again u will see u can't go in game anymore because of server world missing essential dynamic buffer component.
     
  13. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    900
    Like 49? Which file?
     
  14. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    ConfigAuthoring
     
  15. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni Want to check with u. Are u able to reproduce at ur side now?