Search Unity

How to change Mesh Renderer from Light Probe to Lightmaps for many 100's of objects

Discussion in 'General Graphics' started by corb555, Jan 3, 2021.

  1. corb555

    corb555

    Joined:
    Apr 27, 2013
    Posts:
    13
    I have an exterior scene with many 100's of objects. Right now some of the renderers use Light Probes and some use Lightmaps. I'd like to switch them all to be consistent to make lighting more consistent. Is there a way to change hundreds at once or would I have to go into each object and change the lighting? I don't see an obvious way to select those objects and do multi-object editing. I guess what I'm looking for is to select a large number and set Recieve Global Illumination to Lightmaps and have that ignored if the object doesnt have a Mesh Renderer, or a way to select every object with a Mesh Renderer.
     
    Last edited: Jan 3, 2021
  2. AlexTorbin

    AlexTorbin

    Joined:
    Dec 12, 2019
    Posts:
    48
    This can be easily done with editor script (put in Scripts/Editor folder). For example
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public static class CustomSelector
    5. {
    6.     [MenuItem("Tools/Select Mesh Renderers")]
    7.     static void SelectMeshRenderers()
    8.     {
    9.         Selection.objects = Object.FindObjectsOfType<MeshRenderer>();
    10.     }
    11. }
    12.  
    Compile and access from Tools menu.
     
    corb555 likes this.