#Delivering ECS content to application

1 messages · Page 1 of 1 (latest)

fierce kestrel
#

Any way to load ECS content catalog/ContentArchives/EntityScenes from persistent data path as a "local data"?

RuntimeContentSystem.LoadContentCatalog will default to load from StreamingAssets because the URL is null/empty to indicate the data is local.

RuntimeContentManager.LoadLocalCatalogData will throw UnauthorizedAccessException: Access to the path [persistent data path] is denied.

We cannot include the data into SteamingAssets as the build size will become too large, and we want to avoid remote loading through RuntimeContentSystem as we already have a content provider of our own that is handling UGC files for example.

any way to either bypass the RuntimeContentSystem.LoadContentCatalog(that will run ContentDeliveryGlobalState.Initialize) from defaulting to StreamingAssets or allowing RuntimeContentManager.LoadLocalCatalogData to actually read local data from persistent data path?

humble ledge
#

i don't remember api off top of my head, but i'm pretty sure you specify url and a cache path

#

the url can be remote, your own distributed web service or whatever

#

and the cache is just the local place on disk where it's stored

#

and it'll check the cache and load it from there if it already exists

#

i have tested and had this working from a CDN

fierce kestrel
#

yes. when URL is provided, the system will start download operation that fails on local paths. ContentDeliveryGlobalState.Initialize has notes to leave it empty if the data is local, but then forcing it to read from StreamingAssets.

#

it seems it is thought out to work only from StreamingAssets(assets included in the build) or through remote server, but not with persistent data path files downloaded with custom remote content service.

this is the error if the URL is a path to persistent data path: Curl error 7: Failed to connect to localhost port 443 after 0 ms: Error

#

well, maybe I'll just embed the entities package and make the necessary changes there. overall, I need to say that good working examples would be great. it has taken two weeks to figure out how to handle Addressables+ECS Content Management remote asset hybrid setup. awkwardsweat

humble ledge
#

what url are you using for your local path?

#

file://persistentdatapath should work fine

#

[as long as app has permission to the folder]

fierce kestrel
#

/Users/cee/Library/Application Support/xxx/yyy/Data-DEV/Downloads/RemoteAssets/RemoteAssets-ECS

#

I'll try to add the file:// prefix

fierce kestrel
#

no joy with file:// prefix, but made a tiny modification to entities package ContentDeliveryGlobalState:

PathRemapFunc = p => $"{Application.streamingAssetsPath}/{p}";
->
PathRemapFunc = p => $"{cachePath}/{p}";

and now works.

#

for those who are struggling with similar problem, my setup is following:

  1. ECS assets in Assets/Editor/assets-ECS folder. scene with subscene for baking in Assets/assets-EditorOnly folder (included in separate EditorOnly addressable group that is excluded from player build - needed for editor only use to include the ECS scenes to AssetDatabase)
  2. addressable local group assets in Assets/assets-addressable folder (also excluded from player build)
  3. ECS content build script/ScriptableObject with custom inspectorGUI to build and store the ECS scene GUIDs, in the addressables folder and included in the local group with the rest of addressable assets
  4. build ECS content(no need to publish). build script marks the ECS scene GUIDs to the addressable ScriptableObject
  5. build addressables groups normally
  6. upload both to server
  7. custom remote asset downloader downloads addressable and ECS content to persistent data path
  8. Addressables.LoadContentCatalogAsync to load addressable catalog
  9. Addressables.LoadAssetAsync<ECSContentBuildConfig> to load the ECS scene references object
  10. ContentDeliveryGlobalState.Initialize("", cachepath...) (this part is likely not needed as the next step will call the same initialize interally
  11. RuntimeContentSystem.LoadContentCatalog to load the ECS content (modified entities package script to point to cache path instead of StreamingAssets
  12. SceneSystem.LoadSceneAsync to load the ECS scene
#

and for editor use, I have separate USE_EDITOR_ASSETS define controlled from the ECS content build config UI. and then use AssetDatabase on play mode script on addressables and:

  1. AssetDatabase.LoadAssetAtPath<ECSContentBuildConfig> to get the ECS scene GUID
  2. Addressables.LoadSceneAsync to load the ECS scene