Hi,
I want to set the percentage values for the LODGroups via script, but I cannot access those properties.
I searched and read some solutions, but don’t think they refer exactly to what I want.
If you see the attached image, those % values in the red box are what I want to change via script.
Can it be done, if so, how? (It’s fine if I can change them in the editor, doesn’t have to be at run time)
I have a lot of objects with this component, so going in and changing them manually would be EXTREMELY painful…not to mention this probably wont be the last time I do something of this sort!
Thanks!
Nothing? 
EDIT:
Solved it myself! with the help from this thread http://forum.unity3d.com/threads/access-to-lodgroup-data-in-script.123610/
Here is part of my code:
LODGroup lodGroup = gObj.GetComponent<LODGroup>();
if (lodGroup != null) {
//Debug.Log(lodGroup.);
SerializedObject obj = new SerializedObject(lodGroup);
SerializedProperty valArrProp = obj.FindProperty("m_LODs.Array");
for (int i = 0; valArrProp.arraySize > i; i++) {
SerializedProperty sHeight = obj.FindProperty("m_LODs.Array.data[" + i.ToString() + "].screenRelativeHeight");
if (i == 0) {
sHeight.doubleValue = 0.7;
}
if (i == 1) {
sHeight.doubleValue = 0.5;
}
if (i == 2) {
sHeight.doubleValue = 0.1;
}
}
obj.ApplyModifiedProperties();
}
1 Like