SelectAllLights

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 3: Line 3:
 
[[Category: C Sharp]]
 
[[Category: C Sharp]]
 
[[Category: Lights]]
 
[[Category: Lights]]
 +
[[Category: Selection]]
 
Author: Jonathan Czeck (aarku)
 
Author: Jonathan Czeck (aarku)
 
==Description==
 
==Description==

Revision as of 03:17, 1 July 2006

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

<csharp>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;
   }

}</csharp>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox