Under review

Large GC Alloc and Call Count

Shane Berezowski 12 months ago • updated by Aaron Brown 12 months ago 5

I am currently using LushLOD trees in a scene with roughly ~700 trees + bushes controlled by the LushLOD manager. The trees are Unity TreeCreator trees from the asset store that were successfully converted with your one scene.

Starting the scene takes quite a while to finally begin and profiling it reveals that there is a huge amount of GC and nearly 2 million calls to the Start() method as shown below:

Out of curiosity, I did run the default GAIA scene bundled in your asset package and it doesn't hang nearly as bad even though it has more trees by the looks of its call count:

Is there something I may be doing wrong that is causing this? I will note that I have NOT done light map baking yet.

Under review

Sorry for the late reply. I would check that your LOD is set to the default value of 250, and then click the "recalculate parents" button to ensure that the trees are set up correctly on the LOD level of 250. I know that having a very low LOD setting can cause the scene to take longer to laod, and cause a lot of calls to Start(). If this doesn't fix it, let me know and we'll dig a little deeper to try to figure it out.

If your trees were already set at 250 and/or it doesn't make any difference doing this, you might also check to ensure that your entire scene isn't scaled down to something very small, or something very large. If the scene is scaled at all to anything other than 1:1, you might need to do some tweaking to get it to work right.

No worries about the slower response; It's the Christmas holidays, so please relax and enjoy :)

I checked into my project and the LOD is set to 250. I did the "Recalculate Parents" but had the same result afterwards.

As far as scaling, the terrain and player are all 1:1. Some of the trees are scaled down uniformly to fit the scene better. The scaling is done to the prefab of the LushLOD trees in the Output folder generated by your package. The trees were 1:1 beforehand though when I converted them.

Hmm so I looked at your screenshots and it shows, I suppose one call to Start() for each tree in your scene, (it shows 707 calls to Start) but a very large number of calls to something inside of Start that is doing something to the tree materials. 

Only thing I can think of to do is to figure out which specific line of code in that Start() function is triggering that material change. It's the Start() function inside of _LushLODTree.cs, which I don't think is too big of a Start function, so it shouldn't be too much to look through. It's something to do with materials, so that should cut it down quite a bit.,

If your project and scene isn't too big you could try to package it and upload it somewhere, so I can download it and I could try to figure it out.

I tried stepping through some of the code while debugging, but figured it would be best to have you step through since you probably have a much better understanding of what's happening.

Do you have an email I can forward a link to of the scene for you to investigate?