using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using Linework.Common; using UnityEditor; using UnityEditor.PackageManager; using UnityEditor.PackageManager.Requests; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.UIElements; namespace Linework.Editor.Common.Windows { public class CompatibilityCheck : EditorWindow { private List checks; private enum CheckStatus { Untested, InProgress, Completed } private enum ResultEnum { Untested, Pass, Fail, Warning, Info } private class CheckResult { public ResultEnum Result { get; } public string Message { get; } public string Description { get; } public CheckResult(ResultEnum result, string message, string description) { Result = result; Message = message; Description = description; } public override string ToString() { return Message; } } private static SearchRequest _urpSearchRequest; private static AddRequest _addRequest; private const string NoActiveRendererFoundDescription = "Not found. See Edit > Project Settings > Graphics if there is a Default Render Pipeline assigned."; [MenuItem("Window/Linework/Compatibility")] public static void ShowWindow() { var window = GetWindow(); window.titleContent = new GUIContent("Compatibility Check", EditorGUIUtility.IconContent("Settings").image); window.minSize = new Vector2(400, 500); window.maxSize = new Vector2(400, 500); window.Show(); } private void CreateGUI() { checks = new List { new("Unity Version", CheckUnityVersion), new("URP Version", CheckURPVersion), new("Pipeline", CheckActivePipeline), new("Renderer", CheckActiveRenderer), new("Render Graph", CheckRenderGraph), new("Rendering Path", CheckRenderingPath), new("DOTS Hybrid Renderer", CheckHybridRenderer), new("Graphics API", CheckGraphicsAPI), new("Platform", CheckTargetPlatform), new("Anti Aliasing (MSAA)", CheckMSAA), new("SRP Batcher", CheckSRPBatcher), new("Active Pipeline Asset", CheckActiveRenderPipelineAsset), new("STP", CheckSTP) }; var container = new VisualElement { style = { flexGrow = 1 } }; var detailsHeader = new VisualElement { style = { paddingTop = 10, paddingLeft = 5 } }; // Title. var titleContainer = new VisualElement { style = { marginLeft = 4, marginRight = 4, paddingLeft = 2 } }; var titleHeader = new Label("Linework") { style = { fontSize = 19, minWidth = 100, marginTop = 0, paddingBottom = 2, paddingLeft = 0, paddingRight = 2, paddingTop = 1, unityFontStyleAndWeight = FontStyle.Bold } }; titleContainer.Add(titleHeader); detailsHeader.Add(titleContainer); // Version. var versionContainer = new VisualElement { style = { marginLeft = 2, marginTop = 4, paddingLeft = 2 } }; var versionLabel = new Label("1.4.12 • July 2025") { style = { fontSize = 12, height = 18, paddingBottom = 2, paddingLeft = 2, paddingRight = 2, paddingTop = 1, unityFontStyleAndWeight = FontStyle.Bold } }; versionContainer.Add(versionLabel); detailsHeader.Add(versionContainer); // Author. var authorLabel = new Label("By Alexander Ameye") { style = { fontSize = 12, marginBottom = 2, marginLeft = 4, marginRight = 4, marginTop = 2, paddingBottom = 2, paddingLeft = 2, paddingRight = 2, paddingTop = 1 } }; detailsHeader.Add(authorLabel); // Links. var linksContainer = new VisualElement { style = { flexDirection = FlexDirection.Column, paddingBottom = 5, alignItems = Align.FlexStart } }; var linksContainerHorizontal = new VisualElement { style = { flexDirection = FlexDirection.Row, } }; var separator1 = new Label("|") { style = { height = 20, marginLeft = 4, fontSize = 15, color = new Color(0.1686275f, 0.1607843f, 0.1686275f), } }; var separator2 = new Label("|") { style = { height = 20, marginLeft = 4, fontSize = 15, color = new Color(0.1686275f, 0.1607843f, 0.1686275f), } }; var documentationLink = new Label { text = "Documentation", style = { color = new StyleColor(new Color(0.2980392f, 0.4941176f, 1.0f, 1.0f)), marginLeft = 6, paddingLeft = 0, paddingRight = 0 } }; var supportLink = new Label { text = "Support", style = { color = new StyleColor(new Color(0.2980392f, 0.4941176f, 1.0f, 1.0f)), marginLeft = 6, paddingLeft = 0, paddingRight = 0 } }; var reviewLink = new Label { text = "Review", style = { color = new StyleColor(new Color(0.2980392f, 0.4941176f, 1.0f, 1.0f)), marginLeft = 6, paddingLeft = 0, paddingRight = 0 } }; documentationLink.AddManipulator(new Clickable(() => Application.OpenURL("https://linework.ameye.dev"))); supportLink.AddManipulator(new Clickable(() => Application.OpenURL("https://discord.gg/cFfQGzQdPn"))); reviewLink.AddManipulator(new Clickable(() => Application.OpenURL("https://assetstore.unity.com/packages/vfx/shaders/linework-294140#reviews"))); linksContainerHorizontal.Add(documentationLink); linksContainerHorizontal.Add(separator1); linksContainerHorizontal.Add(supportLink); linksContainerHorizontal.Add(separator2); linksContainerHorizontal.Add(reviewLink); linksContainer.Add(linksContainerHorizontal); detailsHeader.Add(linksContainer); // List view. var compatibilityContainer = new VisualElement { style = { backgroundColor = EditorGUIUtility.isProSkin ? new Color(0.1686275f, 0.1607843f, 0.1686275f) : new Color(0.8352941f, 0.8352941f, 0.8352941f), flexDirection = FlexDirection.Column, flexGrow = 1, } }; var child = new VisualElement(); var descriptionLabel = new Label { text = "Select a check to see its description.", style = { unityFontStyleAndWeight = FontStyle.Italic, marginTop = 10, textOverflow = TextOverflow.Ellipsis, whiteSpace = WhiteSpace.Normal, paddingLeft = 5 } }; var listView = new ListView(checks, 20, MakeItem, BindItem) { style = { flexGrow = 1.0f }, showAlternatingRowBackgrounds = AlternatingRowBackground.All, selectionType = SelectionType.Single }; listView.selectionChanged += objects => { if (objects.ToArray()[0] is Check selectedCheck) { descriptionLabel.text = selectedCheck.Result.Description; } }; var buttons = new VisualElement { style = { flexDirection = FlexDirection.Column, justifyContent = Justify.Center, marginTop = 10 } }; var detectButton = new Button(() => { foreach (var checkItem in checks) { RunCheck(checkItem, listView); } }) { text = "Check Compatibility", style = { marginTop = 20, marginLeft = 0, marginRight = 0, flexGrow = 1 } }; buttons.Add(detectButton); var copyInfoButton = new Button(() => { CopyCheckInfoToClipboard(); }) { text = "Copy Result", style = { marginLeft = 0, marginRight = 0, flexGrow = 1 } }; buttons.Add(copyInfoButton); container.Add(detailsHeader); child.Add(listView); child.Add(descriptionLabel); child.Add(buttons); compatibilityContainer.Add(child); container.Add(compatibilityContainer); rootVisualElement.Add(container); return; void BindItem(VisualElement e, int i) { var labels = e.Query