We’ve setup our level using the world composition system. As we move around levels get loaded and unloaded. If a level that has a speed tree in it is unloaded we get a crash on the render thread in FScene::UpdateSpeedTreeWind.
The problem seems to be that a UStaticMesh can be GC’ed before the UStaticMeshComponents that use it are GC’ed. Because the speed tree wind data is only cleaned up by the UStaticMeshComponent::OnUnregister, if the UStaticMesh is GC’ed before the component it seems possible that the render thread can wake up and try to update the speed tree wind data that is now referenced by a dead UStaticMesh pointer.
I’ve currently fixed this by putting an instances of each of our speed trees under the ground in our persistent level, so that the UStaticMesh object never gets GC’ed.
If you only have one speed tree placed then it shouldn’t cause a crash. You’ll need to put lots of speed tree instances down so that there’s lots of UStaticMeshComponents in the level for the one UStaticMesh object. If the UStaticMesh gets garbage collected before the UStaticMeshComponent and the render thread tries to render them, then it should crash.
Also, the speed tree needs to have wind data associated with it. Make sure your trees a animating with the wind
So for the crash to trigger it will be a combination of garbage collection happening post stream out and it randomly GC’ing the UStaticMesh before any of the UStaticMeshComponents and the render thread trying to update the speed tree wind data before the rest of the UStaticMeshComponents being GC’ed.
I’ve gone back and tried this again still with no crash. I’ve used my level streaming test scene and placed ~1500 SpeetTrees along with testing with and without the directional wind source to add the effect to my trees.
Are you able to make a small test project as an example that crashes. I would like to test on my end and see if there is a repro for this.
Since I’m not able to get a crash (at the moment with this) can you attach your crash logs and dmp (Your project folder > Saved > Logs) and a copy of your call stack from crash reporter in a text file?
Thanks for that tip! I’m trying to nail down an exact repro. While I was able to get the crash in a previous project I had already setup level streaming with. When I just tried to re-test in a completely new project I’m not getting the crash. I’m trying to figure out where I’ve missed a step or if something else is going on. I need to get a clear repro and make sure all my steps are in line to get a good bug report submitted so the developer can repro themselves.
Thank you for the logs. I’ll update you once I’ve got this finalized and submitted.