Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug The scene catalog has not been loaded yet on Android client

Discussion in 'NetCode for ECS' started by Occuros, Apr 27, 2021.

  1. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    303
    When using the new platform build pipeline I don't manage to get subscenes to load on android:

    The scene catalog has not been loaded yet


    I used the base build configuration from the astroid sample (with mono 2.0x, and the subscene inside the SceneList).

    If I use the deprecated `ConvertToClientServerEntity` the scene loads, but everything instantiated from a ghostcollection exists but is invisible on the client (like if the renderer isn't loaded).

    The same project creating a Windows build, or run in the editor works without any issues, only when building for android (Quest 2) I encounter these problems.

    Has anyone else encountered this, or has someone a minimal project which works on android with subscenes and prefabs in ghost collections (including mesh renderers).

    Any help would be appreciated.
     
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    931
    As you said, the ConvertToClientServerEntity is deprecated, apart for some hybrid use cases should not be used.
    Seyo the build pipeline can be a little annoying. First: did you add some systems (or whatever else) that assign the
    Code (CSharp):
    1. SceneSystem.BuildConfigurationGUID
    property to the correct build configuration ?

    Also, please check that the catalog.bin is present in your build. I also know there was a bug in the GetFileNameWithoutExtension that was cutting the filename and not loading the proper data.
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,130
    I think long time ago @timjohansson mention about ConvertToClientServerEntity replacement that I believe is ConvertToClientEntity that only convert to client entity. Will this feature ship at next Netcode version?
     
  4. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    931
    There will be no replacement as far as I know. The ConvertToEntity and ConvertToClientServerEntity are deprecated. You should always use subscenes (at the moment). Converting game object on the fly via ConvertToEntity has some problem and caveats.
    Regarding yours issue, could you please try to debug the Android build (by putting a breakpoint in GetPathFromGUID or GetGUIDFromPath in ResourceCatalogData.cs and check why you get that error ? (nothing was loaded or is a path/guid mismatch)
     
  5. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,130
    @CMarastoni. Currently I have classic Unity UI that needs to use ConvertToClientServerEntity to convert and inject Game Object into Entity.


    It just skipped after File.Exists(sceneInfoPath) but I debug at Android Mono debug build though. Do u want me to debug again at Android il2cpp debug build? Btw if possible I would like to get unofficial fix for this Android il2cpp Release build crash.

    upload_2021-5-4_16-5-29.png
     
    Last edited: May 4, 2021
  6. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,130
    @CMarastoni Further update. I get this.

    New Crash Or Exception Received Native Crash - ResourceCatalogData_GetGUIDFromPath_m1DFC599FF027918D5B17B7ACE8367724DD250B7D (C:\...\Library\Il2cppBuildCache\Android\arm64-v8a\il2cppOutput\Unity.Scenes.cpp:3223)
     
  7. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    303
    When looking inside the .apk I can see that the
     catalog.bin
    is indeed present.

    I never used the
    Code (CSharp):
    1. SceneSystem.BuildConfigurationGUID
    in any system. Would I need to use it for netcode to make a viable build for android?

    I created a repo which is basically netcube but with build configuration for android.

    https://github.com/Occuros/NetCubeSceneLoadingIssues

    Any hint on what I might be missing for the scene catalog to load?
     
  8. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    931
    This does not seem a problem with NetCode. I suggest to ask specific question on the forum.
     
  9. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    931
    Why do you need to convert a Unity UI to entities ? I Don't think the UI rendering is actually supported at all. Why not using it as classic game object?

    Is not just for NetCode. The scriptable build pipeline require you to set that property, but it is not documented very well yet unfortunately.
    You can see an example of use in Asteroids. Please look for ConfigureClientSystems and ConfigureServerSystem.
    The value of the hash is the guid that come from the your build configuration metafile you would like to use.
    [/quote]
     
  10. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    303
    Thank you @CMarastoni it kind of works.

    By copying the BuildConfigurationGUID (along with the custom bootstrap) scripts from the asteroid examples the sub-scenes load properly, even though I still get the exception.

    Now here is the confusing part, if I start the client first, and then the server the connection happens normally and the cube is spawned. But if the server is already running and the client starts after I get the connected message on the server but the client never spawns the cube.

    In both cases I receive the
    Address Already in use
    error (even though the server is on a windows machine) followed by scene catalog could not be loaded, when I build it with the
    UNITY_CLIENT
    script define symbol.

    I'm at a loss why it does work when the server starts after the client.

    Anything I might still be missing?
     
  11. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    931
    I don't think in your case you need the custom bootstrap.

    I tried to build the project and running on an android emulator (I don't have an android device at home, sorry) and I also got the "scene catalog ..." error as well, even though the file present but the File.Exist report is not there. This is not not again a NetCode issue, probably a regression.

    umm I need more information in order to really understand what is going on. In the project you shared you have two build configuration for Android: a ClientServer and a Client. I suppose you are using the client one and not the client server right?
    In general I don't see how the window server can affect an android build. it is on another machine .. The only thing I can think of is that you are running for some reason multiple client at the same time or a Client-Server build.

    I didn't saw the Address Already in use error at all when I tried it. Also, if I started the client first and then the server, really nothing happen in my case.
    But I can repro the spawn problem. I'm investigating why
     
    Occuros likes this.
  12. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,130
    @CMarastoni Technically I still using it as classic game object. The reason I use Convert and Inject Game Object is to make classic Unity UI available to ECS land i.e. creating entity to facilitate update ECS data to classic Unity UI meaning I can just use System to get the data I want update to UI and then transfer the data to MonoBehaviour of Unity UI.
     
  13. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    931
    Hi @Occuros, I investigate a little the "non spawning" problem you have in your project.
    I would say I got that issue running the emulator, so it may be not the case with real device, but it is likely to be.

    The problem is due to fact the client game code does not wait until the scene is loaded to send the server the RPC that tell to spawn the cube and set the network stream in game. The RPC is sent by the GoInGameClientSystem as soon a connection is established, that is happening in parallel with the scene loading.
    Usually loading scene is super fast (ms) but on Android devices may take longer (hundred of ms, seconds).

    NetCode 0.6 expect that when you set the network stream "in-game" all the game scene are loaded. We don't support streaming entity scenes once the network stream as the NetworkStreamInGame tag. The ghost prefabs must be already present in world when the client receives the first snapshot from the server and it populate the GhostCollection accordingly.

    I would suggest to add some logic on the client code to wait until the scene is loaded. Since you are still using the GhostCollectionAuthoringComponent you can can just add a
    Code (csharp):
    1.  
    2. RequireSingletonForUpdate<GhostPrefabCollectionComponent>();
    3.  
    to the GoInGameClientSystem inside the OnCreate method. That should fix your problem
     
    Occuros likes this.
  14. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    303
    Fantastic news @CMarastoni, that indeed fixed it (despite the error still claiming the catalog coulnd't be loaded).

    So I finally have a working netcode example running on the Quest 2.

    Thank you so much for looking deeper into it!
     
    CMarastoni likes this.