Unity Entity Content Streaming Missing Documentation

Currently the sample of ECS content streaming is showing how to load entities when serializing them on bake time and not from an outside source, for example, from the cloud.
Has somebody else also encountered the same problem?

For example, after I have published the game, if I would like to create new content for the game without uploading a new version, is it even possible?

This has very little (if anything) to do with Entities. When you make new content available via CDN as Addressables you can include a new scene. This new scene would behave just the same as if the scene was already in the project on build time.

He’s talking about Content Management Content management | Entities | 1.3.8 not addressables, which is an entities only feature. You can’t use addressables with entities.

To answer your question Songerk, yes you can push new content management without a new build. However unlike addressables it doesn’t support incremental builds so you just push your full catalog. Existing content won’t be required to be re-downloaded though, it does maintain a cache of the guid bundles you’ve already acquired so only new/changed ones in the catalog will be downloaded.

And yes the documentation is lacking, a lot. For the most part this is all that is required though.
https://docs.unity3d.com/Packages/com.unity.entities@1.3/manual/content-management-delivery.html

You’d probably want to make the url dynamic though by reading from a simple page that your app has a reference to which redirects to the actual url of your latest catalog so users won’t download while you’re mid updating. You can just update this to the latest catalog/version once you’ve finish uploading (and testing etc.)

3 Likes

Thank you for the advice!
When I try to use the way it shows in documentation, I get stuck.
For example, I try to create an asset bundle from a folder that contains SubScenes that I want to load at runtime. After building and publishing it, that’s how it looks:

And I was able to download it to the folder of the build when doing local server with Python.
But after downloading it, I have no idea what to do with it.
Where in the build should I store the files?
How do I tell the EntitySceneReference that that is the file of scene that I need?
when I am just downloading and storing it the build folder, It’s always unable to find the entity header for the scene

1 Like

I’m not really sure what you mean by download with python?

ContentDeliveryGlobalState.Initialize(remoteUrlRoot, Application.persistentDataPath + "/content-cache", initialContentSet, s => 

Is the code you should be using to download it.

If you for some reason need to download it manually, it goes into the same cache folder which they specify as

Application.persistentDataPath + "/content-cache"

But you can really use anything you want within persistent

Also look at

RuntimeContentSystem.LoadContentCatalog

It’s a bit of a mess and I don’t have a reference in front of me atm so can’t check exactly the methods/setup you need, but once you’ve got it loaded, you can just load the content using the normal guids that match weak objects/weak references. Generally I’d suggest just having a single subscene you reference and have all your own custom code subreferenced from within this, seems easier to me.

With python I just mimicked a server.
What I downloaded the files with:

        public void LoadScene()
        {
#if ENABLE_CONTENT_DELIVERY
            RuntimeContentSystem.LoadContentCatalog(_settings.RemoteLocation, _settings.LocationBuild(), initialContentSet);
            ContentDeliveryGlobalState.RegisterForContentUpdateCompletion(state =>
            {
                Debug.LogError($"{LOAD_CONTENT_ECS} : {state}");
                if (state >= ContentDeliveryGlobalState.ContentUpdateState.ContentReady)
                {
                    LoadMainScene();
                }
            });
#else
            SubSub();
#endif
        }

and after I set the download location as you said to

Application.persistentDataPath + “/content-cache”

it doesn’t throw me an erros of entity couldn’t resolve anymore on scene, but when I try to load the scene with

var Entity = SceneSystem.LoadSceneAsync(state.WorldUnmanaged,scene.ValueRO.SceneReference);

the state of streaming keeps showing that it is on:

SectionStreamingState.LoadRequested

and the SceneSystem.IsSceneLoaded is always false.

And on another problem, this time with EntityPrefabReference, when I try to load the prefab with:

RequestEntityPrefabLoaded

it throws me an error of entity header can’t resolve

Just to be clear, in the editor, everything works as expected.

Does someone know a solution?

Can somebody help?

i provided a solution here, but i havent publish the source code yet, cause im still refactoring it a lot

The ecs official solution is only for downloading all the data from a cloud server and load the set you need, but this isnt ideal for user generated content and dlc,

You might wanna create your own solution to handle this, or if youre interested in my already working solution, i can publish the source code whenever possible.

But my solution currently only cares about local content management, which means theres no internal downloading involves, which means you have to do the downloading on your own and wait for its completion to do ContentManagement.LoadCatalog

After all, my solution can handle external file loading easily without issue, and its not a heavily modified version of entities package, it just an addition to it, so its compatible with the ecs current workflow: RuntimeContentManagement, but it does not compatible with the unity’s internal content management system which are the ContentGlobalState class i think, so everything you initialize with that wont work with mine, but this can be fixed in later (it just a simple remap location for that)

It is expected that users will need to create their own publish scripts - there is a default implementation in RemoteContentCatalogBuildUtility.cs that allows for publishing everything in the StreamingAssets folder of a player build (not the Assets/StreamingAssets folder in your project) into a single content set named “all”.
In order to set up separate content sets, create a custom script that uses RemoteContentCatalogBuildUtility.Publish to process all of the files - there is a functor passed in that allows you to specify all the content sets that each file should belong to. They can be in multiple and this will not duplicate anything. If a null array of content set names is returned for a file, it will remain in the StreamingAssets folder and will not be moved to the remote content directory. Another side note - it is possible to use the runtime data in the editor in play mode by explicitly loading the catalog. You need to copy the contents of a build into you streaming assets folder to do this. Content delivery in the editor was not working but a recent fix allows it to work.

Its nice to hear unity is actually working on fixing this, but it is still fact that youre strict to only using one cloud server to host all the external streaming files you need, the current system doesnt support like direct external file loading so there is no need to use the ContentDownloadService at all, like it just there, and call a method to load the catalog data and do the rest when needed.

In my case i dont need cloud server at all, i just want to differently build the content as i want and maybe provide a way for user generated content for it, but the current workflow doesnt work at all, overall i would like to see a fix to the current Content Streaming system when working in the editor

Remote files are identified by their RemoteContentId. These ids are resolved into RemoteContentLocations that contain all the info needed to deliver the content (url, size, hash, etc). The resolving is handled by a class that derives from the ContentLocationService abstract class. The default implementation loads the remote catalog maps the input ids to the locations. You are able to implement a custom version of this class and either replace the default one or add it to the list of location services (probably first so that it has first access to resolving ids). The DefaultContentLocationService has a Func<sting, string> parameter to transform the url at runtime for each location but I see now that the class is internal - I can probably expose it in a future release.

Is there any news on that?
and also in this Bug ticket that is related to this topic that currently prevents using ECS cloud streaming content, is closed. Do you know maybe why?

The fix for this has actually already landed in both the 1.4 & 1.4 streams for Entities - The 1.3 port of the fix was closed as it is past support. There may have been an error on our side when closing the port that made the public issue appear fully closed. Apologies for the mixup.

Thank you for the clarification and for actually solving it!
Is there a release date for 1.4?

You already can try that fix in 1.4.0-exp.2 for a couple of months Changelog | Entities | 1.4.0-exp.2