level change event for LODGroup

I’m developing an open world game, and a lot of the work I do there is related to optimization. And most of this optimization is to turn features on and off based on distance from the player - to be more precise, the size of their visual appearance - which is exactly what LODGroup does.

I thought this was a problem that could be solved simply by calling an event every time the LOD level changes in the LODGroup, but currently Unity doesn’t have this feature. So, if you want to implement this function, you have to add a script that detects the distance, or add a MonoBehaviour that calls OnBecameVisible() + OnBecameInvisible() for each renderer. However, this is very inefficient and cumbersome. It would be best to call the event directly from the LODGroup without having to create a new script.

1 Like

posted on 2022, no response to something that should have been in unity since version 1.0

In case you want to have fine control over state changes of a game object or components that extends unity given LOD functionality.

Instead, now you need to sort by distances and query LOD group per gameobject, tedious and probably expansive.

I mean folks (Unity devs), this is the ABC of extensive optimization for little cost, Give us a callback please.

1 Like

To be fair, the LOD system has to operate extremely fast - any extension to the code, including adding the possibility of a callback, could jeopardise that right?

let’s go wild and speculate that unity’s engine is extremely inefficient and making such a state changes takes 10,000 cycles per callback, going crazy here as i don’t know the internal working of unity, that is NOTHING in comparison to rendering and ANIMATING a model with 20,000 vertices instead of 10,000 vertices which can cost an additional million cycles (disregarding GPU skinning and any SIMD instruction set that can hasten the operations).

that is ONE example.

Can we get a developer to respond here? year 2024 and we are doing nothing about it?

There is already something like that for ages. It is called the CullingGroup API