Reloading Assemblies takes too long

Objective: Development, using Speckle for receiving models in Unity.

Issue: Constant Editor freezes.

Details: Saving changes in scripts, adding new objects, changing prefabs, triggers a assembly reload in unity starting a process that takes anything from 5 minutes to sometimes 15 minutes to end. The same problem does not exist in other unity project (of the same editor version). The Project I am using now is a clone of the Speckle playground pulled from speckle - unity github, and the changes I currently made are,

  1. Adding the FBX Exporter plugin from Unity Package Manager’s Plugin Registry.
  2. Pull model from speckle stream in the Unity Editor itself.
  3. Write a script to traverse objects in the model and store the data from dictionary to a separate dictionary and then write all that data to one json file.

Also to mention, the cpu and memory usage sky rockets during this. The machine is a lenovo ideapad gaming laptop with an i5 - 10300H and 16 gb 2933 mhz Ram. Which I hope should be sufficient?

After I export the model to fbx, move it to a different project (same editor version but without speckle) and then continue development there, this issue does not occur. (Domain reloads are over within a few seconds, in comparison barely noticeable)

However then I lose the speckle properties data, and this feels sufficient only as a temp workaround. In the long run the project would use speckle to send the model data back with changes made during runtime.

This is the message it is showing after around 8 minutes of waiting.
It starts with the “Reloading Assemblies” Message, proceeds later to "Waiting for Unity to finish executing.

Speckle stream: Speckle

Hi @TanmayKc, We are aware of slow downs experienced when reloading scenes with lots of Speckle objects.

After some investigation, we have identified the cause of these re-load slow downs. When receiving Speckle Objects, we attach non-converted properties to each game object under the SpeckleProperties component.
When receiving lots of objects, or objects that are particularly heavy with additional properties (as is common with Revit objects) This adds up to a lot of data to hold in memory, and to serialize/deserailzie to/from disk.

We have a couple performance improvements in the works for next release (2.16) that speeds up our deserializer a fair bit.

But we are still exploring some other options on the Unity side to more efficiently store these properties.

If you don’t need to access these custom properties, and just want the geometry, then I’ve exposed a toggle to disable attaching of properties.
You should see significant speed improvements this way, as this avoids having to serialize any SpeckleProperties.

We would welcome feedback and any suggestions on ways we could make our connector better.

1 Like

Thanks @Jedd

Yes, we have a lot of objects with a lot of properties and that part won’t be in our control.
But we would really need to use certain properties, if not all of them. So far as a work around, I used a script to save all data relevant to us, in a Json file and used that file during runtime, in a different project, to continue development without the (in-editor) reload slow downs.

It would be really useful if we had a way to send a request to the speckle stream to get only the properties we need. Eg: If we had a specific wall and knew it’s object id, and previously chose not to attach speckle properties, we can do something like SpeckleReceiver.GetPropertiesFor(ObjectId, commitId).
Is there already a way to do something like this?

This is possible using our SDK in a number of ways.

I have added an example here:
that uses a co-routine function to receive the object by id and handle the properties by attaching a SpeckleProperties component.

You’ll likely need to adapt it to meet your needs, but hopefully demonstrates how you can grab properties “on-the-fly”

To use it, you’ll also want to update to the latest version (2.15.3), since I’ve made a couple functions public that were previously private that should help when manually attaching properties.

Any questions feel free to ask!

1 Like