I'm having trouble leading with LOD Group, because I want to know which is the current active LOD level that I see in the screen. I only can access to the percentage with
GameObject.GetComponent<LODGroup>().GetLODs()[size].screenRelativeTransitionHeight;
Someone knows how to solve this? Thanks in advance.
Searching through the answers answers.unity3d.com, I came to this: http://answers.unity3d.com/questions/684467/find-the-lod-step-which-is-currently-used.html
LODGroup lodGroup = obj.GetComponent<LODGroup>();
if (lodGroup != null)
{
Transform lodTransform = lodGroup.transform;
foreach (Transform child in lodTransform)
{
var renderer = child.GetComponent<Renderer> ();
if (renderer != null && renderer.isVisible)
{
Debug.Log("This LODlevel is used: " + child.name);
}
}
}
You can find out which LOD level is currently active by looking into the names of children GameObjects Renderers which are currently visible (visible on the screen).