How do you change the LODGroup Culled percentage via script

HI all,

How do you change the LODGroup Culled percentage via scripting (c#)

I can create an LODGroup and populate with geometry and set the percentage for the different LOD levels but I have no idea how you change the Culled percentage.

I cannot find anything in the documents either :confused:

Any help would be much appreciated

I have read through the documentation (Unity - Scripting API: LODGroup.SetLODs) but there is no mention of it there.

It seams odd that you can’t set it via code.

Thanks

Hey veddcent, did you ever figure this out? I’m needing to do the same thing and can’t find a way to set to culled.

The way i set the cull percentage of the LODGroup is as follows:

I have 100% 66% 33% and want n% for cull

Lets say you want a 5% cull

so 100 x 1 / 20 = 5

if you want 10% cull

100 x 1 / 10 = 10, therefore [ LOD(1f / 10f, renderers); ]

                LODGroup lodGroup = go.GetComponent<LODGroup>();
                LOD[] lods = lodGroup.GetLODs();
                Renderer[] renderers = new Renderer[1];
                renderers[0] = meshRenderer[0];
                lods[lods.Length - 1] = new LOD(1f / 20f, renderers);
                lodGroup.SetLODs(lods);
                lodGroup.RecalculateBounds();

I can turn on LOD 1 immediately by using this code.

            LOD[] lods = lodGroup.GetLODs();
            // turn on LOD 1 immediately.
            lods[0].screenRelativeTransitionHeight = 1f;
            lods[1].screenRelativeTransitionHeight = 0f;
            lodGroup.SetLODs(lods);

I was searching it too, but then I found this:

LODGroup a;
a.ForceLOD(index);

so it can work even better in my case if I want override LOD sometimes. it also have set pass <0 to return it do default processing.