Initializing a huge game object takes a few seconds, and want a loading bar to track it's progress.

I have a fairly big portion of a level that gets loaded as a game object for various reasons - but mostly due to the procedural generation of the object.

It’s awake() function has about 12 sub calls in it, and its start() call has another 14 or so.

I want to track the progress of this using a loading bar, but because this stuff happens within one frame, it ends up just being one giant long frame.

Now, I’m familiar with loading scenes asynchronously, but can I do the same for adding components?

Something like GameObject.AddComponent_Async()? or something similar?

Otherwise, anyone know how to load stuff in like this?

You could take all the functions out of awake and start and instead run them one by one during Update. That would of course require changing your functions to handle that. Thats would fake asynchrocity and I personally do that with AI calculations.

You could put the methods after each other in a coroutine and yield return after each which lets unity proceed to the next frame. IIRC you can also turn Start in a coroutine but not Update.

If the procedural generation can also happen “outside of Unity” (meaning not using restricted resources) you could also make those heavy calculations in a different thread and then apply them to Unity resources in a shorter time frame. Depends on what is needing to be calculated and how you present it in the world.