- Home /
Question by
Nmzikcs · Apr 06, 2013 at 11:33 PM ·
gameobjectlodlodgroup
Add GameObject to lodgroup via script
How i can add GameObject to lodgroup(for example to lod1) via script?
Comment
there's probably no answer to this question anywhere in the universe
Answer by psantoki · May 09, 2014 at 10:53 PM
Here you go Nmzikcs
LODGroup Lodgroup = gameObject.AddComponent();
That creates the LODGroup component where everything will live. Then fill up a LOD[] and pass it to SetLODS. Some rough code--
LOD[] Lods = new LOD[numLODs];
// Fill up Renderer[] arrays. This is the list of drawables per LOD level
Renderer[] allDrawablesInLod0 = new Renderer[numDrawables];
allDrawablesInLod0[0] = (add the renderer of your desired object here)
// Assign list to LOD 0. Do the same for others
Lods[0].renderers = allDrawablesInLod0;
// Make it live!
Lodgroup.SetLODS(Lods);
Lodgroup.RecalculateBounds();
Your answer
Follow this Question
Related Questions
Assign/add gameobject to LOD via script 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
OnBecameVisible and OnBecameInvisible with LOD group. 2 Answers
Terrain Trees LOD working in reverse 1 Answer
Changing gameobject assigned to a variable on input.getkey. 2 Answers