Hello, I am working on a 2D game with hundreds and hundreds of 2D assets that load in the blink of an eye. I also have only three 3D meshes, and each time one is visible on-camera for the first time, there is a MASSIVE delay before the next frame is rendered. My models are not complex, and my computer is a high-end gaming computer with a SSD.
So far, the only solutions I’ve found through research are to display every 3D object for 1 frame at the start of the game. This is way to hacky to use professionally, it still yields a way-too-long delay at the start, and I’ve found that it occasionally doesn’t work.
Even just running play mode in-editor takes longer to load the damn models than it does to test the thing I hit play to test. Does anyone have a solution for this?
Using Unity 5.6.6f2
Anyone? I’ve probably lost hours today alone waiting for these models to load over and over just so I can test the timing of my effects…
It might help if you mention a bit more about the size/complexity of your models or further describe your scene setup. If things are taking too long to load and you are not loading complex models then it sounds like there’s a problem under the hood or a driver issue or something.
We experience small stalls when displaying models for the first time (desktop, console, and mobile) but even relatively large models don’t take very long to load. It’s noticeable as a bump/hiccup in the framerate but doesn’t usually take seconds or minutes.
We try to work around these stalls (in Unity 5.x - 2017.4.x) by forcing selected models to be loaded into memory by rendering them with a special setup camera. During initialisation, a worker camera with a very small frustum and render buffer gets created and positioned around the scene in front of each of the models and renders to encourage things to load. After that, we destroy it. This means that we don’t have to change our scene layout to handle the load, or add more scenes to do it. There are a few similar methods along these lines that could help but this one works for us most of the time.
Thanks for the reply!
We are only loading 3 models, the most complex one in our current project is ~800 verts ~1100 tris with a cube map and a couple textures. We are using several different machines to design, develop, and test our games. All of our games have this issue on all of our machines.
I have tried a similar hack to the one you are suggesting. I render all of our 3D models on our camera while a full-screen effect covers the screen during startup, but this seems to not work once out of every 20-ish runs. Even if this did work… this is a very messy hack! An occasional hack to get things working is ok… but this seems to be a requirement for every game that uses 3D models in Unity 5.6. I never had this problem in Unity 4.6 up to Unity 5.4, and to reiterate, it occurs in all projects and on several different hardware setups.
Try doing a profile and post some results - someone might be able to help if you can pinpoint the cause of the delay. Try creating a smaller repro project and test it on some newer versions of Unity for comparison as well, because the profiler got better and deeper during the 2017.x releases.
Here is a screenshot from the CPU profiler, the large spike occurs when my 3D object becomes visible. The highlighted section in the second screenshot (which is nearly the entire spike) comes from “BehaviourUpdate,” which is shown expanded in the first screenshot (while the spike is selected). As you can see, the massive time delay occurs within Unity internal load/unload code.
I will test using Unity 2017 and attempt to repro in a tiny project when I have some more free time.