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.
  2. Dismiss Notice

Bug RuntimeContentManager issue

Discussion in 'Entity Component System' started by vanRepin, Oct 2, 2023.

  1. vanRepin

    vanRepin

    Joined:
    Oct 29, 2013
    Posts:
    1
    I'm trying to use new content archive approach to load baked scenes. There are few issues I encountered
    * Code inside RuntimeContentSystem is working differently in editor and a build. and I couldn't kinda find a way to make it works in editor same way as in the build
    upload_2023-10-2_15-33-18.png
    I tried to load a scene from content archive in a windows mono build.
    catalogs.bin is loaded and cached in persistent data looks fine, but whenever I try to actually load scene by weak reference - it's fails for gameobject scenes and it silently stuck on "NotYetProcessed" for entities scene.
    I tried both loading from streaming assets and external location(with published content archives).
    upload_2023-10-2_15-37-38.png
    it works all fine in editor sicne loading is overriden for editor. I enabled all necesery compiler arguments for the build. still nothing.
    upload_2023-10-2_15-40-8.png

    When loading gameobject scene in build I get this error
    Code (CSharp):
    1. Debug.Log("Loading Scene");
    2.                     Debug.Log($"Reference {singleton.ValueRW.GameObjectSceneReference.Id.GlobalId.AssetGUID} Valid={singleton.ValueRW.GameObjectSceneReference.IsReferenceValid}");
    3.                     singleton.ValueRW.IsLoading = true;
    4.                     singleton.ValueRW.GameObjectSceneReference.LoadAsync(new ContentSceneParameters
    5.                     {
    6.                         autoIntegrate = true,
    7.                         loadSceneMode = LoadSceneMode.Additive
    8.                     });
    upload_2023-10-2_15-45-20.png

    I traced it back to RuntimeContentManager
    Code (CSharp):
    1. unsafe public static Scene LoadSceneAsync(UntypedWeakReferenceId sceneId, ContentSceneParameters loadParams)
    2.         {
    3. #if ENABLE_CONTENT_DIAGNOSTICS
    4.             LogFunc?.Invoke($"Loading scene {sceneId}");
    5. #endif
    6. #if ENABLE_PROFILER
    7.                 RuntimeContentManagerProfiler.RecordLoadSceneRequest();
    8. #endif
    9.             if (!Catalog.TryGetSceneLocation(sceneId, out var fileId, out var sceneName))
    10.             {
    11. #if UNITY_EDITOR
    12.                 return OverrideLoader.LoadScene(sceneId, loadParams);
    13. #else
    14.                 throw new Exception($"Invalid scene id: {sceneId}");
    15. #endif
    16.             }
    17. ...
    18. }
    This is how I initialize the content delivery:
    Code (CSharp):
    1. private void Start()
    2.     {
    3. #if ENABLE_CONTENT_DELIVERY && !UNITY_EDITOR
    4.         Debug.Log("Content Delivery Enabled");
    5.         Debug.Log("Remote URL Root: " + this.remoteUrlRoot);
    6.         Debug.Log("Cache URL Root: " + Application.persistentDataPath);
    7.         ContentDeliveryGlobalState.LogFunc = Debug.Log;
    8.  
    9.         ContentDeliveryGlobalState.Initialize(this.remoteUrlRoot, Application.persistentDataPath + "/content-cache", this.initialContentSet, s =>
    10.         {
    11.             Debug.Log("Content Delivery State: " + s);
    12.            
    13.             if (s >= ContentDeliveryGlobalState.ContentUpdateState.ContentReady) this.LoadMainScene();
    14.         });
    15.         Debug.Log(ContentDeliveryGlobalState.CurrentContentUpdateState);
    16. #else
    17.         this.LoadMainScene();
    18. #endif
    19.     }
    it looks like archive_dependencies has some issues. like double Dependency
    Code (CSharp):
    1. Archive: eddb48c0d001436a9f80ce236af74441
    2.     File: eddb48c0d001436a9f80ce236af74441
    3. Archive: c15532d57ef970849b07ecedc6a8f223
    4.     File: c15532d57ef970849b07ecedc6a8f223
    5.         Scene: c15532d57ef970849b07ecedc6a8f223:102900000
    6.         Dependency: eddb48c0d001436a9f80ce236af74441
    7.         Dependency: 00000000000000000000000000000000
    8. Archive: 00000000000000000000000000000000
    9.     File: 00000000000000000000000000000000
    I checked entities examples github project but it only has example for loading in the editor without actual built content. I checked the documentation, it also lack much explanation about building and delivering the content.

    if anyone could point me in some direction, I would realy appreciate. Unity Editor version: 2022.3.8f1 Entities version: 1.0.16
     

    Attached Files:

  2. yokobe0012

    yokobe0012

    Joined:
    Nov 2, 2021
    Posts:
    9