SelectAllLights

From Unify Community Wiki
Jump to: navigation, search

Author: Jonathan Czeck (aarku)

Description

This editor script sets the current selection to all the lights in your scene.

Usage

Place this script in YourProject/Assets/Editor and a menu item will automatically appear in the Custom menu after it is compiled.

C# - SelectAllLights.cs

using UnityEngine;
using UnityEditor;
 
public class SelectAllLights : ScriptableObject
{
    [MenuItem ("Custom/Select All Lights")]
    static void SelectLights()
    {
        Light[] lights = FindObjectsOfType(typeof(Light)) as Light[];
        GameObject[] gos = new GameObject[lights.Length];
 
        for (int i=0; i < lights.Length; i++)
        {
            gos[i] = (lights[i]).gameObject;
        }
 
        Selection.objects = gos;
    }
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Tools