EditorUtility
- ClearProgressBar
- CloneComponent
- CollectDeepHierarchy
- CollectDependencies
- CompressTexture
- CopySerialized
- CreateEmptyPrefab
- CreateGameObjectWithHideFlags
- DisplayCancelableProgressBar
- DisplayDialogComplex
- DisplayDialog
- DisplayPopupMenu
- DisplayProgressBar
- ExtractOggFile
- FindPrefabRoot
- FocusProjectWindow
- FormatBytes
- GetObjectEnabled
- GetPrefabParent
- GetPrefabType
- InstanceIDToObject
- InstantiatePrefab
- IsPersistent
- OpenFilePanel
- OpenFolderPanel
- ReconnectToLastPrefab
- ReplacePrefab
- ResetGameObjectToPrefabState
- ResetToPrefabState
- SaveFilePanelInProject
- SaveFilePanel
- SaveFolderPanel
- SetDirty
- SetObjectEnabled
- SetSelectedWireframeHidden
- UnloadUnusedAssetsIgnoreM...
- UnloadUnusedAssets
EditorUtility.InstanceIDToObject 实例ID转物体
static function InstanceIDToObject (instanceID : int) : Object
Description描述
Translates an instance ID to a reference to an object.
转换一个实例ID到一个物体的引用。
If the object is not loaded from disk, loads it from disk.
如果物体没有从磁盘加载,则从磁盘加载。
Editor Window to enter the instance ID and print the name of the object.
编辑器窗口输入实例ID并打印物体的名称。
// Simple editor window that prints on the console the GameObject
// name given an ID.
//在控制台打印游戏物体名称给定的ID
// If no objec is found it prints an error.
//如果没有发现物体,打印错误
class EditorUtilityInstanceIDToObject extends EditorWindow {
var id : int;
@MenuItem("Examples/ID To Name")
static function Init() {
var window = GetWindow(EditorUtilityInstanceIDToObject);
window.position = Rect(0,0,160, 60);
window.Show();
}
function OnGUI() {
id = EditorGUILayout.IntField("Instance ID:",id);
if(GUILayout.Button("Find Name")) {
var obj = EditorUtility.InstanceIDToObject(id);
if(!obj)
Debug.LogError("No object could be found with instance id: " + id);
else
Debug.Log("Object's name: " + obj.name);
}
}
}
最后修改:2011年7月15日 Friday 18:26