protected override void OnSettingsGUI() { GUILayout.Label("Hotspot Settings", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); target = (HotspotTexture)EditorGUILayout.ObjectField(target, typeof(HotspotTexture), false); if (EditorGUI.EndChangeCheck()) { SessionState.SetInt("hostpot-uv-target-id", target.GetInstanceID()); } EditorGUILayout.Space(); GUILayout.Label("Rotate", EditorStyles.boldLabel); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("-45")) { RotateUV(-45); } if (GUILayout.Button("+45")) { RotateUV(45); } } using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("-90")) { RotateUV(-90); } if (GUILayout.Button("+90")) { RotateUV(90); } } GUILayout.Label("Flip", EditorStyles.boldLabel); using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button("X")) { FlipUV(Vector2.right); } if (GUILayout.Button("Y")) { FlipUV(Vector2.up); } } GUILayout.FlexibleSpace(); if (GUILayout.Button("Hotspot selection")) { PerformAction(); } }
public void CheckForSettings() { var targetID = SessionState.GetInt("hostpot-uv-target-id", -1); if (targetID == -1) { return; } target = (HotspotTexture)UnityEditor.EditorUtility.InstanceIDToObject(targetID); if (target == null) { SessionState.SetInt("hostpot-uv-target-id", -1); } }
protected override void OnSettingsGUI() { GUILayout.Label("Hotspot Settings", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); target = (HotspotTexture)EditorGUILayout.ObjectField(target, typeof(HotspotTexture), false); if (EditorGUI.EndChangeCheck()) { SessionState.SetInt("hostpot-uv-target-id", target.GetInstanceID()); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Hotspot selection")) { DoAction(); } }
private static void UpdateTarget(HotspotTexture target) { editingHotspotTexture = target; size = editingHotspotTexture.target.width; Init(); }