SelectMainCamera

From Unify Community Wiki
Jump to: navigation, search

Author: Jonathan Czeck (aarku)

Description

This editor script sets the current selection to your main camera. More technically, it sets the current selection to the first object it finds in your scene that has the tag "MainCamera" on it. This is usually the object titled "Main Camera" that is in your scene by default.

Usage

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

C# - SelectMainCamera.cs

using UnityEngine;
using UnityEditor;
 
public class SelectMainCamera : ScriptableObject
{
    [MenuItem ("Custom/Select Main Camera ^c")]
    static void Select()
    {
        if (Camera.main != null)
            Selection.activeObject = Camera.main.gameObject;
    }
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Tools