本文整理汇总了C#中UnityEditor.Editor.GetInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C# Editor.GetInstanceID方法的具体用法?C# Editor.GetInstanceID怎么用?C# Editor.GetInstanceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.Editor
的用法示例。
在下文中一共展示了Editor.GetInstanceID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeEditMode
private static void ChangeEditMode(SceneViewEditMode mode, Bounds bounds, Editor caller)
{
Editor objectFromInstanceID = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as Editor;
editMode = mode;
ownerID = (mode == SceneViewEditMode.None) ? 0 : caller.GetInstanceID();
if (onEditModeEndDelegate != null)
{
onEditModeEndDelegate(objectFromInstanceID);
}
if ((editMode != SceneViewEditMode.None) && (onEditModeStartDelegate != null))
{
onEditModeStartDelegate(caller, editMode);
}
EditModeChanged(bounds);
InspectorWindow.RepaintAllInspectors();
}
示例2: DoEditModeInspectorModeButton
public static void DoEditModeInspectorModeButton(SceneViewEditMode mode, string label, GUIContent icon, Bounds bounds, Editor caller)
{
if (!EditorUtility.IsPersistent(caller.target))
{
DetectMainToolChange();
if (s_EditColliderButtonStyle == null)
{
s_EditColliderButtonStyle = new GUIStyle("Button");
s_EditColliderButtonStyle.padding = new RectOffset(0, 0, 0, 0);
s_EditColliderButtonStyle.margin = new RectOffset(0, 0, 0, 0);
}
Rect rect = EditorGUILayout.GetControlRect(true, 23f, new GUILayoutOption[0]);
Rect position = new Rect(rect.xMin + EditorGUIUtility.labelWidth, rect.yMin, 33f, 23f);
GUIContent content = new GUIContent(label);
Vector2 vector = GUI.skin.label.CalcSize(content);
Rect rect3 = new Rect(position.xMax + 5f, rect.yMin + ((rect.height - vector.y) * 0.5f), vector.x, rect.height);
int instanceID = caller.GetInstanceID();
bool flag = (editMode == mode) && (ownerID == instanceID);
EditorGUI.BeginChangeCheck();
bool flag2 = GUI.Toggle(position, flag, icon, s_EditColliderButtonStyle);
GUI.Label(rect3, label);
if (EditorGUI.EndChangeCheck())
{
ChangeEditMode(!flag2 ? SceneViewEditMode.None : mode, bounds, caller);
}
}
}
示例3: DoInspectorToolbar
public static void DoInspectorToolbar(SceneViewEditMode[] modes, GUIContent[] guiContents, Bounds bounds, Editor caller)
{
if (!EditorUtility.IsPersistent(caller.target))
{
DetectMainToolChange();
if (s_ToolbarBaseStyle == null)
{
s_ToolbarBaseStyle = "Command";
}
int instanceID = caller.GetInstanceID();
int index = ArrayUtility.IndexOf<SceneViewEditMode>(modes, editMode);
if (ownerID != instanceID)
{
index = -1;
}
EditorGUI.BeginChangeCheck();
int num3 = GUILayout.Toolbar(index, guiContents, s_ToolbarBaseStyle, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
SceneViewEditMode mode = (num3 != index) ? modes[num3] : SceneViewEditMode.None;
ChangeEditMode(mode, bounds, caller);
}
}
}
示例4: IsOwner
public static bool IsOwner(Editor editor)
{
return (editor.GetInstanceID() == ownerID);
}
示例5: IsOwner
public static bool IsOwner(Editor editor)
{
return editor.GetInstanceID() == EditMode.ownerID;
}
示例6: ChangeEditMode
private static void ChangeEditMode(EditMode.SceneViewEditMode mode, Bounds bounds, Editor caller)
{
Editor objectFromInstanceId = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as Editor;
EditMode.editMode = mode;
EditMode.ownerID = mode == EditMode.SceneViewEditMode.None ? 0 : caller.GetInstanceID();
if (EditMode.onEditModeEndDelegate != null)
EditMode.onEditModeEndDelegate(objectFromInstanceId);
if (EditMode.editMode != EditMode.SceneViewEditMode.None && EditMode.onEditModeStartDelegate != null)
EditMode.onEditModeStartDelegate(caller, EditMode.editMode);
EditMode.EditModeChanged(bounds);
InspectorWindow.RepaintAllInspectors();
}
示例7: DoInspectorToolbar
public static void DoInspectorToolbar(EditMode.SceneViewEditMode[] modes, GUIContent[] guiContents, Bounds bounds, Editor caller)
{
if (EditorUtility.IsPersistent(caller.target))
return;
EditMode.DetectMainToolChange();
if (EditMode.s_ToolbarBaseStyle == null)
EditMode.s_ToolbarBaseStyle = (GUIStyle) "Command";
int instanceId = caller.GetInstanceID();
int selected = ArrayUtility.IndexOf<EditMode.SceneViewEditMode>(modes, EditMode.editMode);
if (EditMode.ownerID != instanceId)
selected = -1;
EditorGUI.BeginChangeCheck();
int index = GUILayout.Toolbar(selected, guiContents, EditMode.s_ToolbarBaseStyle, new GUILayoutOption[0]);
if (!EditorGUI.EndChangeCheck())
return;
EditMode.ChangeEditMode(index != selected ? modes[index] : EditMode.SceneViewEditMode.None, bounds, caller);
}
示例8: DoInspectorToolbar
public static void DoInspectorToolbar(EditMode.SceneViewEditMode[] modes, GUIContent[] guiContents, Bounds bounds, Editor caller)
{
if (EditorUtility.IsPersistent(caller.target))
{
return;
}
EditMode.DetectMainToolChange();
if (EditMode.s_ToolbarBaseStyle == null)
{
EditMode.s_ToolbarBaseStyle = "Command";
}
int instanceID = caller.GetInstanceID();
int num = ArrayUtility.IndexOf<EditMode.SceneViewEditMode>(modes, EditMode.editMode);
if (EditMode.ownerID != instanceID)
{
num = -1;
}
EditorGUI.BeginChangeCheck();
int num2 = GUILayout.Toolbar(num, guiContents, EditMode.s_ToolbarBaseStyle, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
EditMode.SceneViewEditMode mode = (num2 != num) ? modes[num2] : EditMode.SceneViewEditMode.None;
EditMode.ChangeEditMode(mode, bounds, caller);
}
}
示例9: DoEditModeInspectorModeButton
public static void DoEditModeInspectorModeButton(EditMode.SceneViewEditMode mode, string label, GUIContent icon, Bounds bounds, Editor caller)
{
if (EditorUtility.IsPersistent(caller.target))
return;
EditMode.DetectMainToolChange();
if (EditMode.s_EditColliderButtonStyle == null)
{
EditMode.s_EditColliderButtonStyle = new GUIStyle((GUIStyle) "Button");
EditMode.s_EditColliderButtonStyle.padding = new RectOffset(0, 0, 0, 0);
EditMode.s_EditColliderButtonStyle.margin = new RectOffset(0, 0, 0, 0);
}
Rect controlRect = EditorGUILayout.GetControlRect(true, 23f, new GUILayoutOption[0]);
Rect position1 = new Rect(controlRect.xMin + EditorGUIUtility.labelWidth, controlRect.yMin, 33f, 23f);
Vector2 vector2 = GUI.skin.label.CalcSize(new GUIContent(label));
Rect position2 = new Rect(position1.xMax + 5f, controlRect.yMin + (float) (((double) controlRect.height - (double) vector2.y) * 0.5), vector2.x, controlRect.height);
int instanceId = caller.GetInstanceID();
bool flag1 = EditMode.editMode == mode && EditMode.ownerID == instanceId;
EditorGUI.BeginChangeCheck();
bool flag2 = GUI.Toggle(position1, flag1, icon, EditMode.s_EditColliderButtonStyle);
GUI.Label(position2, label);
if (!EditorGUI.EndChangeCheck())
return;
EditMode.ChangeEditMode(!flag2 ? EditMode.SceneViewEditMode.None : mode, bounds, caller);
}