LODGroup.GetLODs

Switch to Manual

Declaration

public LOD[] GetLODs();

Returns

LOD[] The LOD array.

Description

Returns the array of LODs.

#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;

[ExecuteInEditMode] public class DisplayLods : MonoBehaviour { #if UNITY_EDITOR void OnGUI() { // Display on the Game view top level information of each LOD for the selected LODGroup. if (gameObject != Selection.activeGameObject) return;

var lodGroup = GetComponent<LODGroup>();

if (lodGroup && gameObject == Selection.activeGameObject) { LOD[] lods = lodGroup.GetLODs();

GUILayout.BeginVertical(gameObject.name); for (int i=0 ; i<lods.Length ; i++) { LOD lod = lods[i];

GUILayout.Label($"LOD {i} : Renderer count = {lod.renderers.Length}, Fade trans. width = {lod.fadeTransitionWidth}, Screen rel. trans. height = {lod.screenRelativeTransitionHeight}"); } GUILayout.EndVertical(); } } #endif }

Additional resources: LOD, SetLODs


Did you find this page useful? Please give it a rating: