Substances cause LoadSceneAsync to hang in version 5.5

We have run into a fairly serious bug with 5.5. When we load our scene with LoadSceneAsync. Unity Hangs and never returns from the load process. We have spent a week trying to figure out why unity will not complete the load, but we are not able to figure it out. Unity gives no errors or anything, it just never returns. The Scene loads fine with LoadScene. It is if there is some deadlock inside of unity. It is worth mentioning that works fine in 5.4.3p4 so it is specific to 5.5

Our project is fairly large (like 30GB) so I cannot submit it in a bug report but I could provide it if needed.

I filed this as Case 862849

1 Like

Does your scene contain large LightingData files?

I was able to track this down, at least find the source, and we found we could reproduce this on any scene in our project. The details of this are a bit complicated to explain here.

In an effort to have stable ID that we can us for assets over the network. We have a editor tool that goes over the instances and Resources and their dependencies and builds a list of IDs that we can refer to things by. The data is ultimately saved with the scene.

In Unity 5.5 if we do this across all the resources (instead of a subset like game objects) the scene becomes unloadable by LoadSceneAsync. Also It is really not obvious why or why this only happens with version 5.5

Ah, alright. I thought perhaps it had to do with big LightingData files which causes the same issue for another user (see report here), but that was happening in 5.3 and 5.4 as well.

I’ll add the extra information you provided as a note to your report for QA.

Thank you for your help.

I was able to track this down further. In our system (without going into a lot of detail) I am keeping references to a lot of assets in the scene. The code was doing something like this

Object[ ] allAssets=Resources.LoadAll(“”);
… add references to a scene object

In 5.5 this started to make the scene unloadable

So what I did was broke this down into separate loads for each type of asset.

sourceObjects.AddRange(Resources.LoadAll(“”,typeof(GameObject)));
sourceObjects.AddRange(Resources.LoadAll(“”, typeof(Mesh)));
sourceObjects.AddRange(Resources.LoadAll(“”, typeof(Texture2D)));
sourceObjects.AddRange(Resources.LoadAll(“”, typeof(Material)));
sourceObjects.AddRange(Resources.LoadAll(“”, typeof(AnimationClip)));
sourceObjects.AddRange(Resources.LoadAll(“”, typeof(Sprite)));
sourceObjects.AddRange(Resources.LoadAll(“”, typeof(TextAsset)));

I found the that call to load the materials is actually which causes the deadlock. If I comment that one line out this works fine.

I have seen other posts where people are talking about hangs with substances.

We are using substances in our project so it might be this. This doesn’t just take a long time either, I have let the run overnight the load never finishes.

Either way I would encourage your guys to look at this it looks like you may have introduced some sort of deadlock having to do with materials in 5.5.

I was able to track this down to a single material which was a substance. I will try to put this in a standalone project next,

I was able to replicate this in a very simple project. Basically if a scene contains a reference to a Substance material. LoadSceneAsync will hang 100% of the time.

I didn’t know how to add this project to a bug, so I filed it as a new one with a very simple repro case

I filed it as Case 863716

3 Likes

Thank you for digging into this further and isolating the cause, that helps a lot! I see the team is already looking into this.

1 Like

@DDNA thanks for digging into this, I had the same issue and I’m glad you could trace it to substances (which we also use). I hope that this can be resolved soon. @SaraCecilia any chance this will make it into 5.6?

I’m not sure it will make it into 5.6, but I’ve brought it up with the developers again today to see if there is a possibility.

1 Like

Okay! Thanks for looking into this. :slight_smile: