visualdesigncafe / nature-renderer

Nature Renderer is a plugin for the Unity game engine to efficiently render vegetation on your terrains.
https://visualdesigncafe.com/nature-renderer/
0 stars 0 forks source link

Xmas comes early #71

Open Jaakk0S opened 3 months ago

Jaakk0S commented 3 months ago

Adding tree prefabs causes constant flashing of prefab lists.

This just started happening after adding my 115:th tree prefab. I am using The Vegetation Engine but I have debugged to see there's no loop running on that side. I have been using the same version of NR for over a year and haven't seen this issue before.

To reproduce: see video (has speech too). This just recently started happening when I added all my prefabs. It doesn't seem to matter which prefab I add. If I remove some existing prefabs and add new ones, it doesn't happen. As if 115 was too many.

The problem persists if I restart the editor. There is no log output into console.

I am on Unity 2021.3.32f1, NR 2021.2.1, URP 13.

https://github.com/user-attachments/assets/0b357caf-07fb-4253-80c3-919ce42dd2a0

Jaakk0S commented 3 months ago

Found the solution. Btw this is an actual issue.

Likely the code is using AssetPreview.GetAssetPreview(obj) to generate the previews in the tree and detail lists. I was also getting an exception from another library that was asset preview related. Both issues went away by increasing the memory available for those previews:

AssetPreview.SetPreviewTextureCacheSize(10000);

So the flashing "xmas lights" come from the last entries in the texture cache being pushed out and the library trying to keep recreating them.

You should make this value configurable or at least mention it in settings. I have about 130 trees+details altogther and I'm also using TerrainComposer2 that makes heavy use of previews, so the space runs out.