Unloading cubemap assets and then loading a material which references that cubemap gives error

I have multiple scenes in my projects and each scene has separate assets, which are tagged level-1, level-2, etc.

When I go from level-1 to 2 I unload level-1 assets and load level 2 assets and load scene (level 2). The issue is that when I go from level 1 to level 2 it works fine but if I go from level 2 to back to level 1, it gives me an error when it tries to load a material having a cubemap which is currently unloaded because I findbyTag all the assets and let’s say the material is found first and when I try to load it first, it throws this error (because the cubemap assets are not loaded at that moment).

I created repro project here:


Press 1 to load the material + texture, then press to unload the material + texture + cubmap then press 1 again to load the material (will give error now).

How can I tackle this issue? should I load all the cubemap assets of a level first then load its textures and then its materials?, is there a sequence I should follow to load my assets?

calling @ray to see what’s going on here.