- Home /
Change Mesh Renderer size property?
In the mesh renderer, I need to set the 'Size' under the Materials tab to 0 so it becomes invisible but still renders the shadows. How do I do this?
Comment
Answer by intellivancemullins · Dec 19, 2018 at 05:21 PM
have you or anyone solve this question? I am trying to figure how to change number of size in script C#.
Answer by jimmycrazyskills · Dec 19, 2018 at 06:44 PM
Hi mate, you can set the materials to 0 by setting the materials to a new array of materials:
gameObject.GetComponent<MeshRenderer> ().materials = new Material[] { };
However, this wouldn't cast a shadow like you want. But you could maybe have multiple objects and use layering to determine what gets rendered to the camera (e.g object on one layer, shadow on another layer).
Hope this helped :)