#Failing at building and then loading a simple Content Archive

1 messages · Page 1 of 1 (latest)

heady cloak
#

I'm trying to build and then load a simple Content Archive subscene containing one single entity. However I am a complete loss, as when I try to load its subscene, I get a NRE at a extremely low level, and Play Mode hangs which makes me kill the Unity process to reboot. This only happens if I have the debugger attached, otherwise I'd never see this and it doesn't appear in the Editor log.
https://hastebin.ianhon.com/6255

However if I go a little bit earlier in the ContentDeliveryGlobalState, I find the following log. I also can find this if I launch without the debugger attached as the last logged message:
https://hastebin.ianhon.com/561b

I have absolutely no idea why it is packing and trying to load a ContentArchive with all 0s, and rebuilding it still gives me the same result. No such thing appears in the DebugCatalog, which seems fine:
https://hastebin.ianhon.com/9b54

The code that bakes the Content Archive is the following:
https://hastebin.ianhon.com/55e9

Then I load the subscene, given the guid, using a manifest file generated at build time, using SceneSystem.LoadSceneAsync.
https://hastebin.ianhon.com/5519

I'm been poking at this for a couple of days and I simply do not know what to do and what could be making this happen. Apparently, the all 0s archive might be a reference to a Editor only Catalog/Archive, but I'm doing the same build steps as per documentation.

heady cloak
#

Am I NOT expected to use SceneSystem to load content? it's the only thing that I can think of, but I'd have to change approach from loading scenes through GUIDs to WeakAssetReferenceIDs

limpid hazel
#

I think you should really get this working in a normal way first on a default world instead of your custom one etc using the steps provided in the content sample

#

it'll help a lot in indentifying if there is an issue with the actual content code or your use of it

#

also are you testing this in editor or builds

#

because content archives work very different around this

heady cloak
#

Editor in PlayMode

#

I have kinda messy classes because at first I was directly loading the subscene directly, not the content archive

#

I plan to be able to do both at the same time so anytime I have to test something I can just load the subscene directly without having to rebake all the time

#

Like, just a toggle

#

I am aware that the system do not update in edit mode because application isn't running

#

I don't think its a World issue given that that's mostly the lack of systems, which I managed to load in into the custom World, but if it still doesn't work after changing the loading from SceneSystem to the Runtime Content i'll also try changing that

#

What is strange to me is when the NRE happens it has a WeakAssetReferenceID of the subscene trying to get loaded assigned to some variable in some step

#

So loading through that might work.... but then it might fail because its dependencies aren't loaded in

#

its weird and complicated

#

You'd figure Unity would have some kind of example of loading into a custom staging World given that loading is one of those things that you'd want fully complete and done before actually moving to the actual game, which is what I am doing here, but there's nothing about that

heady cloak
#
        public WeakSceneListScriptableObject Settings;
        public UnityEditor.SceneAsset HighFidelityScene;
        // We use WeakObjectSceneReference here instead of UntypedWeakReferenceId because
        // UntypedWeakReferenceId does not take a scene as input in the inspector.
        // Alternatively, we could use SceneAsset and then create a WeakObjectSceneReference in the baker with this code:
        // new WeakObjectSceneReference { Id = UntypedWeakReferenceId.CreateFromObjectInstance(authoring.LowFidelityScene) };
        public WeakObjectSceneReference LowFidelityScene;
#

I really don't know if changing from loading from the guid to a WeakObjectSceneReference will do, but I hope it does

limpid hazel
#

Once content is loaded, you can just load your subscene normally with SceneSystem.LoadSceneAsync Hash128 or EntitySceneReference

WeakObjectSceneReference is for normal scenes, not subscenes

heady cloak
#

Thats how I am loading it right now, with a Hash128 of the GUID

#

I have no idea what's wrong then

heady cloak
#

I just had an idea, maybe its failing because the Scene contains the default cube model asset?

heady cloak
#

nvm

#

Still freaking out at this part

heady cloak
#

Have the debugger attached while im loading / unloading / opening / closing the scene and I wasn't aware that the runtime content manager was also used in the Editor. In my tests I do a Cleanup() of it because I thought it wouldn't be used (was trying to simulate a clean Player I guess?) So it's probably that

#

Seems like that was it

#
GitHub

The Entities package provides a modern Entity Component System (ECS) implementation with a basic set of systems and components made for Unity. 📦 [Mirrored from UPM, not affiliated with Unity Techno...

#

After a cleanup ALWAYS reinitialize

#

And that the runtime content manager state is a globalstate, including the editor and all worlds, so if you do something wrong everything will die