You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEditor; |
|
|
|
[CustomEditor(typeof(UIdSystem))] |
|
public class UIdSystemInspector : Editor |
|
{ |
|
public override void OnInspectorGUI() |
|
{ |
|
DrawDefaultInspector(); |
|
|
|
if (IsEditMode()) |
|
{ |
|
GUILayout.BeginHorizontal(); |
|
{ |
|
GUILayout.FlexibleSpace(); |
|
|
|
if (GUILayout.Button("Update Id", GUILayout.MinWidth(120f), GUILayout.MinHeight(22f))) |
|
{ |
|
Undo.RecordObject(target, "Update Id"); |
|
target.InvokeMethod("UpdateId", true); |
|
EditorUtility.SetDirty(target); |
|
} |
|
|
|
GUILayout.Space(20f); |
|
|
|
if (GUILayout.Button("Reassign Id", GUILayout.MinWidth(120f), GUILayout.MinHeight(22f))) |
|
{ |
|
Undo.RecordObject(target, "Reassign Id"); |
|
target.InvokeMethod("ReassignId", true); |
|
EditorUtility.SetDirty(target); |
|
} |
|
|
|
GUILayout.FlexibleSpace(); |
|
} |
|
GUILayout.EndHorizontal(); |
|
} |
|
} |
|
|
|
private bool IsEditMode() |
|
{ |
|
return !(EditorApplication.isPlaying || EditorApplication.isPaused || EditorApplication.isPlayingOrWillChangePlaymode); |
|
} |
|
} |