From 1ed312553d5604840428c1fc1804cf97b978e870 Mon Sep 17 00:00:00 2001 From: remi Date: Wed, 29 Jan 2025 21:32:59 +0100 Subject: [PATCH 1/3] Convert readme to UITK and fix link styling --- .../Scripts/Editor/ReadmeEditor.cs | 247 +++++------------- .../Scripts/Editor/ReadmeEditor.uss | 73 ++++++ .../Scripts/Editor/ReadmeEditor.uss.meta | 11 + .../Scripts/Editor/ReadmeEditorDark.uss | 3 + .../Scripts/Editor/ReadmeEditorDark.uss.meta | 11 + .../Scripts/Editor/ReadmeEditorLight.uss | 3 + .../Scripts/Editor/ReadmeEditorLight.uss.meta | 11 + 7 files changed, 183 insertions(+), 176 deletions(-) create mode 100644 com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss create mode 100644 com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss.meta create mode 100644 com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss create mode 100644 com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss.meta create mode 100644 com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss create mode 100644 com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs index f983e049c09..e3a8310ce9f 100644 --- a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs @@ -1,236 +1,131 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; using UnityEditor; -using System; using System.IO; -using System.Reflection; +using UnityEngine.UIElements; [CustomEditor(typeof(Readme))] [InitializeOnLoad] -public class ReadmeEditor : Editor +sealed class ReadmeEditor : Editor { - static string s_ShowedReadmeSessionStateName = "ReadmeEditor.showedReadme"; + const string k_ussFormat = "Assets/TutorialInfo/Scripts/Editor/ReadmeEditor{0}.uss"; + const string k_ShowedReadmeSessionStateName = "ReadmeEditor.showedReadme"; + const string k_ReadmeSourceDirectory = "Assets/TutorialInfo"; - static string s_ReadmeSourceDirectory = "Assets/TutorialInfo"; - - const float k_Space = 16f; + bool m_ImGUIStyleInitialized; + [SerializeField] GUIStyle m_TitleStyle; static ReadmeEditor() - { - EditorApplication.delayCall += SelectReadmeAutomatically; - } - - static void RemoveTutorial() - { - if (EditorUtility.DisplayDialog("Remove Readme Assets", - - $"All contents under {s_ReadmeSourceDirectory} will be removed, are you sure you want to proceed?", - "Proceed", - "Cancel")) - { - if (Directory.Exists(s_ReadmeSourceDirectory)) - { - FileUtil.DeleteFileOrDirectory(s_ReadmeSourceDirectory); - FileUtil.DeleteFileOrDirectory(s_ReadmeSourceDirectory + ".meta"); - } - else - { - Debug.Log($"Could not find the Readme folder at {s_ReadmeSourceDirectory}"); - } - - var readmeAsset = SelectReadme(); - if (readmeAsset != null) - { - var path = AssetDatabase.GetAssetPath(readmeAsset); - FileUtil.DeleteFileOrDirectory(path + ".meta"); - FileUtil.DeleteFileOrDirectory(path); - } - - AssetDatabase.Refresh(); - } - } + => EditorApplication.delayCall += SelectReadmeAutomatically; static void SelectReadmeAutomatically() { - if (!SessionState.GetBool(s_ShowedReadmeSessionStateName, false)) + if (!SessionState.GetBool(k_ShowedReadmeSessionStateName, false)) { var readme = SelectReadme(); - SessionState.SetBool(s_ShowedReadmeSessionStateName, true); + SessionState.SetBool(k_ShowedReadmeSessionStateName, true); if (readme && !readme.loadedLayout) { - LoadLayout(); + EditorUtility.LoadWindowLayout(Path.Combine(Application.dataPath, "TutorialInfo/Layout.wlt")); readme.loadedLayout = true; } } } - static void LoadLayout() - { - var assembly = typeof(EditorApplication).Assembly; - var windowLayoutType = assembly.GetType("UnityEditor.WindowLayout", true); - var method = windowLayoutType.GetMethod("LoadWindowLayout", BindingFlags.Public | BindingFlags.Static); - method.Invoke(null, new object[] { Path.Combine(Application.dataPath, "TutorialInfo/Layout.wlt"), false }); - } - static Readme SelectReadme() { var ids = AssetDatabase.FindAssets("Readme t:Readme"); - if (ids.Length == 1) - { - var readmeObject = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0])); - - Selection.objects = new UnityEngine.Object[] { readmeObject }; - - return (Readme)readmeObject; - } - else + if (ids.Length != 1) { Debug.Log("Couldn't find a readme"); return null; } - } - protected override void OnHeaderGUI() + var readmeObject = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0])); + Selection.objects = new UnityEngine.Object[] { readmeObject }; + return (Readme)readmeObject; + } + + void RemoveTutorial() { - var readme = (Readme)target; - Init(); - - var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth / 3f - 20f, 128f); - - GUILayout.BeginHorizontal("In BigTitle"); + if (EditorUtility.DisplayDialog("Remove Readme Assets", + + $"All contents under {k_ReadmeSourceDirectory} will be removed, are you sure you want to proceed?", + "Proceed", + "Cancel")) { - if (readme.icon != null) + if (Directory.Exists(k_ReadmeSourceDirectory)) { - GUILayout.Space(k_Space); - GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth)); + FileUtil.DeleteFileOrDirectory(k_ReadmeSourceDirectory); + FileUtil.DeleteFileOrDirectory(k_ReadmeSourceDirectory + ".meta"); } - GUILayout.Space(k_Space); - GUILayout.BeginVertical(); + else { + Debug.Log($"Could not find the Readme folder at {k_ReadmeSourceDirectory}"); + } - GUILayout.FlexibleSpace(); - GUILayout.Label(readme.title, TitleStyle); - GUILayout.FlexibleSpace(); + var readmeAsset = SelectReadme(); + if (readmeAsset != null) + { + var path = AssetDatabase.GetAssetPath(readmeAsset); + FileUtil.DeleteFileOrDirectory(path + ".meta"); + FileUtil.DeleteFileOrDirectory(path); } - GUILayout.EndVertical(); - GUILayout.FlexibleSpace(); + + AssetDatabase.Refresh(); } - GUILayout.EndHorizontal(); } - public override void OnInspectorGUI() + //Remove ImGUI + protected sealed override void OnHeaderGUI() { } + public sealed override void OnInspectorGUI() { } + + public override VisualElement CreateInspectorGUI() { + VisualElement root = new(); + root.styleSheets.Add(AssetDatabase.LoadAssetAtPath(string.Format(k_ussFormat,""))); + root.styleSheets.Add(AssetDatabase.LoadAssetAtPath(string.Format(k_ussFormat, EditorGUIUtility.isProSkin ? "Dark" : "Light"))); + var readme = (Readme)target; - Init(); + //Header + VisualElement title = new(); + title.AddToClassList("title"); + title.Add(new Image() { image = readme.icon }); + title.Add(new Label(readme.title)); + root.Add(title); + + //Content foreach (var section in readme.sections) { + VisualElement part = new(); + part.AddToClassList("section"); + if (!string.IsNullOrEmpty(section.heading)) { - GUILayout.Label(section.heading, HeadingStyle); + var header = new Label(section.heading); + header.AddToClassList("header"); + part.Add(header); } if (!string.IsNullOrEmpty(section.text)) - { - GUILayout.Label(section.text, BodyStyle); - } + part.Add(new Label(section.text)); if (!string.IsNullOrEmpty(section.linkText)) { - if (LinkLabel(new GUIContent(section.linkText))) - { - Application.OpenURL(section.url); - } + var link = new Label(section.linkText); + link.AddToClassList("link"); + link.RegisterCallback(evt => Application.OpenURL(section.url)); + part.Add(link); } - GUILayout.Space(k_Space); + root.Add(part); } - if (GUILayout.Button("Remove Readme Assets", ButtonStyle)) - { - RemoveTutorial(); - } - } - - GUIStyle LinkStyle - { - get { return m_LinkStyle; } - } - - [SerializeField] - GUIStyle m_LinkStyle; - - GUIStyle TitleStyle - { - get { return m_TitleStyle; } - } - - [SerializeField] - GUIStyle m_TitleStyle; - - GUIStyle HeadingStyle - { - get { return m_HeadingStyle; } - } - - [SerializeField] - GUIStyle m_HeadingStyle; - - GUIStyle BodyStyle - { - get { return m_BodyStyle; } - } - - [SerializeField] - GUIStyle m_BodyStyle; - - GUIStyle ButtonStyle - { - get { return m_ButtonStyle; } - } - - [SerializeField] - GUIStyle m_ButtonStyle; - - void Init() - { - m_BodyStyle = new GUIStyle(EditorStyles.label); - m_BodyStyle.wordWrap = true; - m_BodyStyle.fontSize = 14; - m_BodyStyle.richText = true; - - m_TitleStyle = new GUIStyle(m_BodyStyle); - m_TitleStyle.fontSize = 26; - - m_HeadingStyle = new GUIStyle(m_BodyStyle); - m_HeadingStyle.fontStyle = FontStyle.Bold; - m_HeadingStyle.fontSize = 18; - - m_LinkStyle = new GUIStyle(m_BodyStyle); - m_LinkStyle.wordWrap = false; - - // Match selection color which works nicely for both light and dark skins - m_LinkStyle.normal.textColor = new Color(0x00 / 255f, 0x78 / 255f, 0xDA / 255f, 1f); - m_LinkStyle.stretchWidth = false; - - m_ButtonStyle = new GUIStyle(EditorStyles.miniButton); - m_ButtonStyle.fontStyle = FontStyle.Bold; - } - - bool LinkLabel(GUIContent label, params GUILayoutOption[] options) - { - var position = GUILayoutUtility.GetRect(label, LinkStyle, options); - - Handles.BeginGUI(); - Handles.color = LinkStyle.normal.textColor; - Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax)); - Handles.color = Color.white; - Handles.EndGUI(); - - EditorGUIUtility.AddCursorRect(position, MouseCursor.Link); + var button = new Button(RemoveTutorial) { text = "Remove Readme Assets" }; + button.AddToClassList("remove-readme-button"); + root.Add(button); - return GUI.Button(position, label, LinkStyle); + return root; } } diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss new file mode 100644 index 00000000000..bd84967693a --- /dev/null +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss @@ -0,0 +1,73 @@ +:root { + --link-color: blue; +} + +.title +{ + margin: -2px -6px 0px -15px; + padding: 20px 6px 20px 22px; + flex-direction: row; + align-items: center; + background-color: var(--unity-colors-inspector_titlebar-background); + height: 139px; + border-bottom-width: 1px; + border-bottom-color: var(--unity-colors-inspector_titlebar-border); +} + +.title > Image +{ + max-width: 120px; + max-height: 69px; +} + +.title > Label +{ + margin-left: 25px; + padding: 0px 0px 0px 0px; + font-size: 26px; + flex-shrink: 1; + white-space: normal; + overflow: hidden; +} + +.section +{ + align-items:flex-start; + margin-bottom: 16px; +} + +.section * +{ + font-size: 14px; + white-space: normal; +} + +.header +{ + font-size: 20px; + -unity-font-style: bold; +} + +.link +{ + white-space: nowrap; + overflow: hidden; + border-bottom-width: 0px; + margin-bottom: 0px; + border-bottom-color: var(--link-color); + color: var(--link-color); +} + +.link:hover +{ + border-bottom-width: 1px; + margin-bottom: -1px; + cursor: link; +} + +.remove-readme-button +{ + font-size: 13px; + -unity-font-style: bold; + margin: 1px 0px 1px 0px; +} \ No newline at end of file diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss.meta new file mode 100644 index 00000000000..cb3639fb639 --- /dev/null +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2c670ece470f4c4fa6712b8dc28a9bb +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss new file mode 100644 index 00000000000..b9bc823c7d4 --- /dev/null +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss @@ -0,0 +1,3 @@ +:root { + --link-color: #7DA0FF; +} \ No newline at end of file diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss.meta new file mode 100644 index 00000000000..07fda7218d6 --- /dev/null +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f902e57f049a7f47986618de93f5ee1 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss new file mode 100644 index 00000000000..72fa34b90b6 --- /dev/null +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss @@ -0,0 +1,3 @@ +:root { + --link-color: #3C28D2; +} \ No newline at end of file diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss.meta new file mode 100644 index 00000000000..d3aa3274595 --- /dev/null +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69e7ab73923f93149821ac3a88b84856 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 From 16ed3c0f8653a0d6271f5101b5656dfb35ec336f Mon Sep 17 00:00:00 2001 From: remi Date: Thu, 30 Jan 2025 18:51:40 +0100 Subject: [PATCH 2/3] Clean TutorialInfo and uss class names --- .../Assets/Readme.asset | 3 ++ .../TutorialInfo/{Scripts => }/Editor.meta | 0 .../{Scripts => }/Editor/ReadmeEditor.cs | 31 +++++++++---------- .../{Scripts => }/Editor/ReadmeEditor.cs.meta | 0 .../TutorialInfo/{Scripts => }/Readme.cs | 6 +++- .../TutorialInfo/{Scripts => }/Readme.cs.meta | 0 .../{Scripts.meta => StyleSheets.meta} | 0 .../Editor => StyleSheets}/ReadmeEditor.uss | 20 ++++++------ .../ReadmeEditor.uss.meta | 0 .../ReadmeEditorDark.uss | 0 .../ReadmeEditorDark.uss.meta | 0 .../ReadmeEditorLight.uss | 0 .../ReadmeEditorLight.uss.meta | 0 13 files changed, 33 insertions(+), 27 deletions(-) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts => }/Editor.meta (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts => }/Editor/ReadmeEditor.cs (80%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts => }/Editor/ReadmeEditor.cs.meta (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts => }/Readme.cs (65%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts => }/Readme.cs.meta (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts.meta => StyleSheets.meta} (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts/Editor => StyleSheets}/ReadmeEditor.uss (87%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts/Editor => StyleSheets}/ReadmeEditor.uss.meta (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts/Editor => StyleSheets}/ReadmeEditorDark.uss (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts/Editor => StyleSheets}/ReadmeEditorDark.uss.meta (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts/Editor => StyleSheets}/ReadmeEditorLight.uss (100%) rename com.unity.template.hdrp-blank/Assets/TutorialInfo/{Scripts/Editor => StyleSheets}/ReadmeEditorLight.uss.meta (100%) diff --git a/com.unity.template.hdrp-blank/Assets/Readme.asset b/com.unity.template.hdrp-blank/Assets/Readme.asset index 186e39b3ff6..1a2aa01c80c 100644 --- a/com.unity.template.hdrp-blank/Assets/Readme.asset +++ b/com.unity.template.hdrp-blank/Assets/Readme.asset @@ -12,6 +12,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fcf7219bab7fe46a1ad266029b2fee19, type: 3} m_Name: Readme m_EditorClassIdentifier: + commonStyle: {fileID: 7433441132597879392, guid: d2c670ece470f4c4fa6712b8dc28a9bb, type: 3} + darkStyle: {fileID: 7433441132597879392, guid: 1f902e57f049a7f47986618de93f5ee1, type: 3} + lightStyle: {fileID: 7433441132597879392, guid: 69e7ab73923f93149821ac3a88b84856, type: 3} icon: {fileID: 2800000, guid: d19680cd422524695938fbe55cc3b3bd, type: 3} title: HDRP Empty Template sections: diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor/ReadmeEditor.cs similarity index 80% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor/ReadmeEditor.cs index e3a8310ce9f..170d5bd6286 100644 --- a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor/ReadmeEditor.cs @@ -7,13 +7,9 @@ [InitializeOnLoad] sealed class ReadmeEditor : Editor { - const string k_ussFormat = "Assets/TutorialInfo/Scripts/Editor/ReadmeEditor{0}.uss"; const string k_ShowedReadmeSessionStateName = "ReadmeEditor.showedReadme"; const string k_ReadmeSourceDirectory = "Assets/TutorialInfo"; - bool m_ImGUIStyleInitialized; - [SerializeField] GUIStyle m_TitleStyle; - static ReadmeEditor() => EditorApplication.delayCall += SelectReadmeAutomatically; @@ -82,17 +78,23 @@ public sealed override void OnInspectorGUI() { } public override VisualElement CreateInspectorGUI() { + var readme = (Readme)target; + VisualElement root = new(); - root.styleSheets.Add(AssetDatabase.LoadAssetAtPath(string.Format(k_ussFormat,""))); - root.styleSheets.Add(AssetDatabase.LoadAssetAtPath(string.Format(k_ussFormat, EditorGUIUtility.isProSkin ? "Dark" : "Light"))); + root.styleSheets.Add(readme.commonStyle); + root.styleSheets.Add(EditorGUIUtility.isProSkin ? readme.darkStyle : readme.lightStyle); - var readme = (Readme)target; + VisualElement ChainWithClass(VisualElement created, string className) + { + created.AddToClassList(className); + return created; + } //Header VisualElement title = new(); title.AddToClassList("title"); - title.Add(new Image() { image = readme.icon }); - title.Add(new Label(readme.title)); + title.Add(ChainWithClass(new Image() { image = readme.icon }, "title__icon")); + title.Add(ChainWithClass(new Label(readme.title), "title__text")); root.Add(title); //Content @@ -102,19 +104,14 @@ public override VisualElement CreateInspectorGUI() part.AddToClassList("section"); if (!string.IsNullOrEmpty(section.heading)) - { - var header = new Label(section.heading); - header.AddToClassList("header"); - part.Add(header); - } + part.Add(ChainWithClass(new Label(section.heading), "section__header")); if (!string.IsNullOrEmpty(section.text)) - part.Add(new Label(section.text)); + part.Add(ChainWithClass(new Label(section.text), "section__body")); if (!string.IsNullOrEmpty(section.linkText)) { - var link = new Label(section.linkText); - link.AddToClassList("link"); + var link = ChainWithClass(new Label(section.linkText), "section__link"); link.RegisterCallback(evt => Application.OpenURL(section.url)); part.Add(link); } diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor/ReadmeEditor.cs.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.cs.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/Editor/ReadmeEditor.cs.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Readme.cs b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Readme.cs similarity index 65% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Readme.cs rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/Readme.cs index 9b0ae32d4f0..814f0e4f28a 100644 --- a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Readme.cs +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Readme.cs @@ -1,8 +1,12 @@ -using System; +using System; using UnityEngine; +using UnityEngine.UIElements; public class Readme : ScriptableObject { + public StyleSheet commonStyle; + public StyleSheet darkStyle; + public StyleSheet lightStyle; public Texture2D icon; public string title; public Section[] sections; diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Readme.cs.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/Readme.cs.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Readme.cs.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/Readme.cs.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditor.uss similarity index 87% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditor.uss index bd84967693a..f2a3b405a98 100644 --- a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss +++ b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditor.uss @@ -14,13 +14,13 @@ border-bottom-color: var(--unity-colors-inspector_titlebar-border); } -.title > Image +.title__icon { max-width: 120px; max-height: 69px; } -.title > Label +.title__text { margin-left: 25px; padding: 0px 0px 0px 0px; @@ -36,20 +36,22 @@ margin-bottom: 16px; } -.section * +.section__header { - font-size: 14px; + font-size: 20px; white-space: normal; + -unity-font-style: bold; } -.header +.section__body { - font-size: 20px; - -unity-font-style: bold; + font-size: 14px; + white-space: normal; } -.link +.section__link { + font-size: 14px; white-space: nowrap; overflow: hidden; border-bottom-width: 0px; @@ -58,7 +60,7 @@ color: var(--link-color); } -.link:hover +.section__link:hover { border-bottom-width: 1px; margin-bottom: -1px; diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditor.uss.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditor.uss.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditor.uss.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorDark.uss similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorDark.uss diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorDark.uss.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorDark.uss.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorDark.uss.meta diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorLight.uss similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorLight.uss diff --git a/com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss.meta b/com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorLight.uss.meta similarity index 100% rename from com.unity.template.hdrp-blank/Assets/TutorialInfo/Scripts/Editor/ReadmeEditorLight.uss.meta rename to com.unity.template.hdrp-blank/Assets/TutorialInfo/StyleSheets/ReadmeEditorLight.uss.meta From d1463eafef258056626ba8ff386a09e9a5353fa3 Mon Sep 17 00:00:00 2001 From: remi Date: Fri, 31 Jan 2025 12:00:42 +0100 Subject: [PATCH 3/3] bump --- .../Packages/com.unity.template.hdrp-blank/CHANGELOG.md | 6 ++++++ .../com.unity.template.hdrp-blank/ValidationExceptions.json | 2 +- .../Packages/com.unity.template.hdrp-blank/package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/CHANGELOG.md b/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/CHANGELOG.md index be8a1ec3219..83ffbfe3124 100644 --- a/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/CHANGELOG.md +++ b/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project template will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [17.0.8] - 2025-01-31 + +### Changed + +- Updated ReadmeEditor to use UITK with more readable link colors + ## [17.0.7] - 2025-01-27 ### Changed diff --git a/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/ValidationExceptions.json b/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/ValidationExceptions.json index 29831fce5bb..d2f2201c692 100644 --- a/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/ValidationExceptions.json +++ b/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/ValidationExceptions.json @@ -2,7 +2,7 @@ "ErrorExceptions": [ { "ValidationTest": "Primed Library Validation", - "PackageVersion": "17.0.7" + "PackageVersion": "17.0.8" } ], "WarningExceptions": [] diff --git a/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/package.json b/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/package.json index 03229708288..f3b5ceab6b6 100644 --- a/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/package.json +++ b/com.unity.template.hdrp-blank/Packages/com.unity.template.hdrp-blank/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.template.hdrp-blank", "displayName":"3D HDRP", - "version": "17.0.7", + "version": "17.0.8", "type": "template", "host": "hub", "unity": "2023.3",