HierarchySelectObject

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: Category: Editor Author: Martin Schultz (MartinSchultz) == Description == Editor script that automatically selects and scrolls to a specific gameObject in Uni...)
 
m (JavaScript - SelectMyObject.js)
Line 16: Line 16:
 
<javascript>
 
<javascript>
  
@MenuItem ("Tools/Select RaceManager")
+
@MenuItem ("Tools/Select My Object")
 
static function SelectRaceManager() {
 
static function SelectRaceManager() {
 
//var obj = GameObject.FindObjectOfType(RaceManager);
 
//var obj = GameObject.FindObjectOfType(RaceManager);

Revision as of 20:53, 5 December 2009

Author: Martin Schultz (MartinSchultz)

Description

Editor script that automatically selects and scrolls to a specific gameObject in Unity's hierarchy window. This is very useful if you have a large scale project with lots of objects in the hierarchy window and you want to quickly jump to a specific object you often need to jump to. This script scrolls automatically the hierarchy window to your object, pings it (gets highlighted in yellow) and gets also automatically selected so you can edit it in the inspector.

Usage

You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

Define a gameObject from the hierarchy window that you often need, for example a "RaceManager" object or an "Boss Enemy".

JavaScript - SelectMyObject.js

<javascript>

@MenuItem ("Tools/Select My Object") static function SelectRaceManager() { //var obj = GameObject.FindObjectOfType(RaceManager); var obj = GameObject.Find("your object here from the hierarchy window"); EditorGUIUtility.PingObject(obj); //Selection.activeGameObject = obj.gameObject; Selection.activeGameObject = obj; } </javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox