2025-07-08 14:28:40 -04:00
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine ;
using UnityEditor ;
using System ;
using UnityEngine.Networking ;
using System.Collections ;
using System.Collections.Generic ;
namespace AmplifyShaderEditor
{
public class ASEStartScreen : EditorWindow
{
[MenuItem( "Window/Amplify Shader Editor/Start Screen", false, 1999 )]
public static void Init ( )
{
ASEStartScreen window = ( ASEStartScreen ) GetWindow ( typeof ( ASEStartScreen ) , true , "Amplify Shader Editor Start Screen" ) ;
window . minSize = new Vector2 ( 650 , 500 ) ;
window . maxSize = new Vector2 ( 650 , 500 ) ;
window . Show ( ) ;
}
private static readonly string ChangeLogGUID = "580cccd3e608b7f4cac35ea46d62d429" ;
private static readonly string ResourcesGUID = "c0a0a980c9ba86345bc15411db88d34f" ;
private static readonly string BuiltInGUID = "e00e6f90ab8233e46a41c5e33917c642" ;
private static readonly string UniversalGUID = "a9d68dd8913f05d4d9ce75e7b40c6044" ;
private static readonly string HighDefinitionGUID = "d1c0b77896049554fa4b635531caf741" ;
private static readonly string IconGUID = "2c6536772776dd84f872779990273bfc" ;
public static readonly string ChangelogURL = "https://amplify.pt/Banner/ASEchangelog.json" ;
2026-03-14 03:13:10 -04:00
private static readonly string ManualURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual" ;
private static readonly string BasicURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials#Official_-_Basics" ;
private static readonly string BeginnerURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials#Official_-_Beginner_Series" ;
private static readonly string NodesURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Nodes" ;
private static readonly string SRPURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Scriptable_Rendering_Pipeline" ;
private static readonly string FunctionsURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual#Shader_Functions" ;
private static readonly string TemplatesURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Templates" ;
private static readonly string APIURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/API" ;
private static readonly string SGtoASEURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Shader_Graph_to_ASE" ;
2025-07-08 14:28:40 -04:00
private static readonly string DiscordURL = "https://discordapp.com/invite/EdrVAP5" ;
private static readonly string ForumURL = "https://forum.unity.com/threads/best-tool-asset-store-award-amplify-shader-editor-node-based-shader-creation-tool.430959/" ;
private static readonly string SiteURL = "http://amplify.pt/download/" ;
private static readonly string StoreURL = "https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570" ;
private static readonly GUIContent SamplesTitle = new GUIContent ( "Shader Samples" , "Import samples according to you project rendering pipeline" ) ;
private static readonly GUIContent ResourcesTitle = new GUIContent ( "Learning Resources" , "Check the online wiki for various topics about how to use ASE with node examples and explanations" ) ;
private static readonly GUIContent CommunityTitle = new GUIContent ( "Community" , "Need help? Reach us through our discord server or the official support Unity forum" ) ;
private static readonly GUIContent UpdateTitle = new GUIContent ( "Latest Update" , "Check the lastest additions, improvements and bug fixes done to ASE" ) ;
private static readonly GUIContent ASETitle = new GUIContent ( "Amplify Shader Editor" , "Are you using the latest version? Now you know" ) ;
private const string OnlineVersionWarning = "Please enable \"Allow downloads over HTTP*\" in Player Settings to access latest version information via Start Screen." ;
Vector2 m_scrollPosition = Vector2 . zero ;
Preferences . ShowOption m_startup = Preferences . ShowOption . Never ;
[NonSerialized]
Texture packageIcon = null ;
[NonSerialized]
Texture textIcon = null ;
[NonSerialized]
Texture webIcon = null ;
GUIContent HDRPbutton = null ;
GUIContent URPbutton = null ;
GUIContent BuiltInbutton = null ;
GUIContent Manualbutton = null ;
GUIContent Basicbutton = null ;
GUIContent Beginnerbutton = null ;
GUIContent Nodesbutton = null ;
GUIContent SRPusebutton = null ;
GUIContent Functionsbutton = null ;
GUIContent Templatesbutton = null ;
GUIContent APIbutton = null ;
2026-03-14 03:13:10 -04:00
GUIContent SGtoASEbutton = null ;
2025-07-08 14:28:40 -04:00
GUIContent DiscordButton = null ;
GUIContent ForumButton = null ;
GUIContent ASEIcon = null ;
RenderTexture rt ;
[NonSerialized]
GUIStyle m_buttonStyle = null ;
[NonSerialized]
GUIStyle m_buttonLeftStyle = null ;
[NonSerialized]
GUIStyle m_buttonRightStyle = null ;
[NonSerialized]
GUIStyle m_minibuttonStyle = null ;
[NonSerialized]
GUIStyle m_labelStyle = null ;
[NonSerialized]
GUIStyle m_linkStyle = null ;
private ChangeLogInfo m_changeLog ;
private bool m_infoDownloaded = false ;
private string m_newVersion = string . Empty ;
private static Dictionary < int , ASESRPPackageDesc > m_srpSamplePackages = new Dictionary < int , ASESRPPackageDesc > ( )
{
2026-03-14 03:13:10 -04:00
{ ( int ) ASESRPBaseline . ASE_SRP_10_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_10_X , "2edbf4a9b9544774bbef617e92429664" , "9da5530d5ebfab24c8ecad68795e720f" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_11_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_11_X , "2edbf4a9b9544774bbef617e92429664" , "9da5530d5ebfab24c8ecad68795e720f" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_12_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_12_X , "13ab599a7bda4e54fba3e92a13c9580a" , "aa102d640b98b5d4781710a3a3dd6983" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_13_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_13_X , "13ab599a7bda4e54fba3e92a13c9580a" , "aa102d640b98b5d4781710a3a3dd6983" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_14_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_14_X , "f6f268949ccf3f34fa4d18e92501ed82" , "7a0bb33169d95ec499136d59cb25918b" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_15_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_15_X , "69bc3229216b1504ea3e28b5820bbb0d" , "641c955d37d2fac4f87e00ac5c9d9bd8" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_16_X , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_16_X , "4f665a06c5a2aa5499fa1c79ac058999" , "2690f45490c175045bbdc63395bf6278" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_17_0 , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_17_0 , "8a87ed432fe2d97498c0de5fae312e35" , "fbd1fd9b3a70fad429d1eaaa5799c2a5" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_17_1 , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_17_1 , "7c3bfbbeb9427b94099254e2e2768ad4" , "3579d9cf4b75c564faa8fffc58a9f3f6" ) } ,
{ ( int ) ASESRPBaseline . ASE_SRP_17_2 , new ASESRPPackageDesc ( ASESRPBaseline . ASE_SRP_17_2 , "c5303861611f41c438a30be552da5de4" , "0023a0858ba124646a55dfcb7231ed46" ) } ,
2025-07-08 14:28:40 -04:00
} ;
private void OnEnable ( )
{
rt = new RenderTexture ( 16 , 16 , 0 ) ;
rt . Create ( ) ;
2026-03-14 03:13:10 -04:00
m_startup = ( Preferences . ShowOption ) EditorPrefs . GetInt ( Preferences . User . Keys . StartUp , 0 ) ;
2025-07-08 14:28:40 -04:00
2026-03-14 03:13:10 -04:00
if ( textIcon = = null )
2025-07-08 14:28:40 -04:00
{
Texture icon = EditorGUIUtility . IconContent ( "TextAsset Icon" ) . image ;
var cache = RenderTexture . active ;
RenderTexture . active = rt ;
Graphics . Blit ( icon , rt ) ;
RenderTexture . active = cache ;
textIcon = rt ;
Manualbutton = new GUIContent ( " Manual" , textIcon ) ;
Basicbutton = new GUIContent ( " Basic use tutorials" , textIcon ) ;
Beginnerbutton = new GUIContent ( " Beginner Series" , textIcon ) ;
Nodesbutton = new GUIContent ( " Node List" , textIcon ) ;
SRPusebutton = new GUIContent ( " SRP HDRP/URP use" , textIcon ) ;
Functionsbutton = new GUIContent ( " Shader Functions" , textIcon ) ;
Templatesbutton = new GUIContent ( " Shader Templates" , textIcon ) ;
APIbutton = new GUIContent ( " Node API" , textIcon ) ;
2026-03-14 03:13:10 -04:00
SGtoASEbutton = new GUIContent ( " Shader Graph to ASE" , textIcon ) ;
2025-07-08 14:28:40 -04:00
}
2026-03-14 03:13:10 -04:00
if ( packageIcon = = null )
2025-07-08 14:28:40 -04:00
{
packageIcon = EditorGUIUtility . IconContent ( "BuildSettings.Editor.Small" ) . image ;
HDRPbutton = new GUIContent ( " HDRP Samples" , packageIcon ) ;
URPbutton = new GUIContent ( " URP Samples" , packageIcon ) ;
BuiltInbutton = new GUIContent ( " Built-In Samples" , packageIcon ) ;
}
2026-03-14 03:13:10 -04:00
if ( webIcon = = null )
2025-07-08 14:28:40 -04:00
{
webIcon = EditorGUIUtility . IconContent ( "BuildSettings.Web.Small" ) . image ;
DiscordButton = new GUIContent ( " Discord" , webIcon ) ;
ForumButton = new GUIContent ( " Unity Forum" , webIcon ) ;
}
2026-03-14 03:13:10 -04:00
if ( m_changeLog = = null )
2025-07-08 14:28:40 -04:00
{
var changelog = AssetDatabase . LoadAssetAtPath < TextAsset > ( AssetDatabase . GUIDToAssetPath ( ChangeLogGUID ) ) ;
string lastUpdate = string . Empty ;
2026-03-14 03:13:10 -04:00
if ( changelog ! = null )
2025-07-08 14:28:40 -04:00
{
int oldestReleaseIndex = changelog . text . LastIndexOf ( string . Format ( "v{0}.{1}.{2}" , VersionInfo . Major , VersionInfo . Minor , VersionInfo . Release ) ) ;
lastUpdate = changelog . text . Substring ( 0 , changelog . text . IndexOf ( "\nv" , oldestReleaseIndex + 25 ) ) ; // + "\n...";
lastUpdate = lastUpdate . Replace ( "* " , "\u2022 " ) ;
}
m_changeLog = new ChangeLogInfo ( VersionInfo . FullNumber , lastUpdate ) ;
}
if ( ASEIcon = = null )
{
ASEIcon = new GUIContent ( AssetDatabase . LoadAssetAtPath < Texture2D > ( AssetDatabase . GUIDToAssetPath ( IconGUID ) ) ) ;
}
}
private void OnDisable ( )
{
2026-03-14 03:13:10 -04:00
if ( rt ! = null )
2025-07-08 14:28:40 -04:00
{
rt . Release ( ) ;
DestroyImmediate ( rt ) ;
}
}
public void OnGUI ( )
{
2026-03-14 03:13:10 -04:00
if ( ! m_infoDownloaded )
2025-07-08 14:28:40 -04:00
{
m_infoDownloaded = true ;
StartBackgroundTask ( StartRequest ( ChangelogURL , ( ) = >
{
2026-03-14 03:13:10 -04:00
if ( string . IsNullOrEmpty ( www . error ) )
2025-07-08 14:28:40 -04:00
{
2026-03-14 03:13:10 -04:00
ChangeLogInfo temp ;
try
{
temp = ChangeLogInfo . CreateFromJSON ( www . downloadHandler . text ) ;
}
catch ( Exception )
{
temp = null ;
}
if ( temp ! = null & & temp . Version > = m_changeLog . Version )
{
m_changeLog = temp ;
}
2025-07-08 14:28:40 -04:00
2026-03-14 03:13:10 -04:00
int version = m_changeLog . Version ;
int major = version / 10000 ;
int minor = version / 1000 - major * 10 ;
int release = version / 100 - ( version / 1000 ) * 10 ;
int revision = version - ( version / 100 ) * 100 ;
2025-07-08 14:28:40 -04:00
2026-03-14 03:13:10 -04:00
m_newVersion = major + "." + minor + "." + release + ( revision > 0 ? "." + revision : "" ) ;
2025-07-08 14:28:40 -04:00
2026-03-14 03:13:10 -04:00
Repaint ( ) ;
}
2025-07-08 14:28:40 -04:00
} ) ) ;
}
2026-03-14 03:13:10 -04:00
if ( m_buttonStyle = = null )
2025-07-08 14:28:40 -04:00
{
m_buttonStyle = new GUIStyle ( GUI . skin . button ) ;
m_buttonStyle . alignment = TextAnchor . MiddleLeft ;
}
2026-03-14 03:13:10 -04:00
if ( m_buttonLeftStyle = = null )
2025-07-08 14:28:40 -04:00
{
m_buttonLeftStyle = new GUIStyle ( "ButtonLeft" ) ;
m_buttonLeftStyle . alignment = TextAnchor . MiddleLeft ;
m_buttonLeftStyle . margin = m_buttonStyle . margin ;
m_buttonLeftStyle . margin . right = 0 ;
}
2026-03-14 03:13:10 -04:00
if ( m_buttonRightStyle = = null )
2025-07-08 14:28:40 -04:00
{
m_buttonRightStyle = new GUIStyle ( "ButtonRight" ) ;
m_buttonRightStyle . alignment = TextAnchor . MiddleLeft ;
m_buttonRightStyle . margin = m_buttonStyle . margin ;
m_buttonRightStyle . margin . left = 0 ;
}
2026-03-14 03:13:10 -04:00
if ( m_minibuttonStyle = = null )
2025-07-08 14:28:40 -04:00
{
m_minibuttonStyle = new GUIStyle ( "MiniButton" ) ;
m_minibuttonStyle . alignment = TextAnchor . MiddleLeft ;
m_minibuttonStyle . margin = m_buttonStyle . margin ;
m_minibuttonStyle . margin . left = 20 ;
m_minibuttonStyle . normal . textColor = m_buttonStyle . normal . textColor ;
m_minibuttonStyle . hover . textColor = m_buttonStyle . hover . textColor ;
}
2026-03-14 03:13:10 -04:00
if ( m_labelStyle = = null )
2025-07-08 14:28:40 -04:00
{
m_labelStyle = new GUIStyle ( "BoldLabel" ) ;
m_labelStyle . margin = new RectOffset ( 4 , 4 , 4 , 4 ) ;
m_labelStyle . padding = new RectOffset ( 2 , 2 , 2 , 2 ) ;
m_labelStyle . fontSize = 13 ;
}
2026-03-14 03:13:10 -04:00
if ( m_linkStyle = = null )
2025-07-08 14:28:40 -04:00
{
var inv = AssetDatabase . LoadAssetAtPath < Texture2D > ( AssetDatabase . GUIDToAssetPath ( "1004d06b4b28f5943abdf2313a22790a" ) ) ; // find a better solution for transparent buttons
m_linkStyle = new GUIStyle ( ) ;
m_linkStyle . normal . textColor = new Color ( 0.2980392f , 0.4901961f , 1f ) ;
m_linkStyle . hover . textColor = Color . white ;
m_linkStyle . active . textColor = Color . grey ;
m_linkStyle . margin . top = 3 ;
m_linkStyle . margin . bottom = 2 ;
m_linkStyle . hover . background = inv ;
m_linkStyle . active . background = inv ;
}
EditorGUILayout . BeginHorizontal ( GUIStyle . none , GUILayout . ExpandWidth ( true ) ) ;
{
// left column
EditorGUILayout . BeginVertical ( GUILayout . Width ( 175 ) ) ;
{
GUILayout . Label ( SamplesTitle , m_labelStyle ) ;
EditorGUILayout . BeginHorizontal ( ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( HDRPbutton , m_buttonLeftStyle ) )
{
if ( ASEPackageManagerHelper . CurrentHDRPBaseline ! = ASESRPBaseline . ASE_SRP_INVALID )
{
ImportSample ( HDRPbutton . text , TemplateSRPType . HDRP ) ;
}
else
{
EditorUtility . DisplayDialog ( "Import Sample" , "Import failed because a valid HDRP package could not be found on this project.\n\nPlease install the \"High Definition RP\" package via \"Window/Package Manager\" before attempting to import HDRP samples again." , "OK" ) ;
}
}
2025-07-08 14:28:40 -04:00
EditorGUILayout . EndHorizontal ( ) ;
EditorGUILayout . BeginHorizontal ( ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( URPbutton , m_buttonLeftStyle ) )
{
if ( ASEPackageManagerHelper . CurrentURPBaseline ! = ASESRPBaseline . ASE_SRP_INVALID )
{
ImportSample ( URPbutton . text , TemplateSRPType . URP ) ;
}
else
{
EditorUtility . DisplayDialog ( "Import Sample" , "Import failed because valid URP package could not be found on this project.\n\nPlease install the \"Universal RP\" package via \"Window/Package Manager\" before attempting to import URP samples again." , "OK" ) ;
}
}
2025-07-08 14:28:40 -04:00
EditorGUILayout . EndHorizontal ( ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( BuiltInbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
ImportSample ( BuiltInbutton . text , TemplateSRPType . BiRP ) ;
GUILayout . Space ( 10 ) ;
GUILayout . Label ( ResourcesTitle , m_labelStyle ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( Manualbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( ManualURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( Basicbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( BasicURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( Beginnerbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( BeginnerURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( Nodesbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( NodesURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( SRPusebutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( SRPURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( Functionsbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( FunctionsURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( Templatesbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( TemplatesURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( APIbutton , m_buttonStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( APIURL ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( SGtoASEbutton , m_buttonStyle ) )
Application . OpenURL ( SGtoASEURL ) ;
2025-07-08 14:28:40 -04:00
}
EditorGUILayout . EndVertical ( ) ;
// right column
EditorGUILayout . BeginVertical ( GUILayout . Width ( 650 - 175 - 9 ) , GUILayout . ExpandHeight ( true ) ) ;
{
GUILayout . Label ( CommunityTitle , m_labelStyle ) ;
EditorGUILayout . BeginHorizontal ( GUILayout . ExpandWidth ( true ) ) ;
{
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( DiscordButton , GUILayout . ExpandWidth ( true ) ) )
2025-07-08 14:28:40 -04:00
{
Application . OpenURL ( DiscordURL ) ;
}
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( ForumButton , GUILayout . ExpandWidth ( true ) ) )
2025-07-08 14:28:40 -04:00
{
Application . OpenURL ( ForumURL ) ;
}
}
EditorGUILayout . EndHorizontal ( ) ;
GUILayout . Label ( UpdateTitle , m_labelStyle ) ;
m_scrollPosition = GUILayout . BeginScrollView ( m_scrollPosition , "ProgressBarBack" , GUILayout . ExpandHeight ( true ) , GUILayout . ExpandWidth ( true ) ) ;
GUILayout . Label ( m_changeLog . LastUpdate , "WordWrappedMiniLabel" , GUILayout . ExpandHeight ( true ) ) ;
GUILayout . EndScrollView ( ) ;
EditorGUILayout . BeginHorizontal ( GUILayout . ExpandWidth ( true ) ) ;
{
EditorGUILayout . BeginVertical ( ) ;
GUILayout . Label ( ASETitle , m_labelStyle ) ;
GUILayout . Label ( "Installed Version: " + VersionInfo . StaticToString ( ) ) ;
2026-03-14 03:13:10 -04:00
if ( m_changeLog . Version > VersionInfo . FullNumber )
2025-07-08 14:28:40 -04:00
{
var cache = GUI . color ;
GUI . color = Color . red ;
GUILayout . Label ( "New version available: " + m_newVersion , "BoldLabel" ) ;
GUI . color = cache ;
}
else
{
var cache = GUI . color ;
GUI . color = Color . green ;
GUILayout . Label ( "You are using the latest version" , "BoldLabel" ) ;
GUI . color = cache ;
}
EditorGUILayout . BeginHorizontal ( ) ;
GUILayout . Label ( "Download links:" ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( "Amplify" , m_linkStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( SiteURL ) ;
GUILayout . Label ( "-" ) ;
2026-03-14 03:13:10 -04:00
if ( GUILayout . Button ( "Asset Store" , m_linkStyle ) )
2025-07-08 14:28:40 -04:00
Application . OpenURL ( StoreURL ) ;
EditorGUILayout . EndHorizontal ( ) ;
GUILayout . Space ( 7 ) ;
EditorGUILayout . EndVertical ( ) ;
GUILayout . FlexibleSpace ( ) ;
EditorGUILayout . BeginVertical ( ) ;
GUILayout . Space ( 7 ) ;
GUILayout . Label ( ASEIcon ) ;
EditorGUILayout . EndVertical ( ) ;
}
EditorGUILayout . EndHorizontal ( ) ;
}
EditorGUILayout . EndVertical ( ) ;
}
EditorGUILayout . EndHorizontal ( ) ;
2026-03-14 03:13:10 -04:00
EditorGUILayout . BeginHorizontal ( "ProjectBrowserBottomBarBg" , GUILayout . ExpandWidth ( true ) , GUILayout . Height ( 22 ) ) ;
2025-07-08 14:28:40 -04:00
{
GUILayout . FlexibleSpace ( ) ;
EditorGUI . BeginChangeCheck ( ) ;
var cache = EditorGUIUtility . labelWidth ;
EditorGUIUtility . labelWidth = 100 ;
2026-03-14 03:13:10 -04:00
m_startup = ( Preferences . ShowOption ) EditorGUILayout . EnumPopup ( "Show At Startup" , m_startup , GUILayout . Width ( 220 ) ) ;
2025-07-08 14:28:40 -04:00
EditorGUIUtility . labelWidth = cache ;
2026-03-14 03:13:10 -04:00
if ( EditorGUI . EndChangeCheck ( ) )
2025-07-08 14:28:40 -04:00
{
2026-03-14 03:13:10 -04:00
EditorPrefs . SetInt ( Preferences . User . Keys . StartUp , ( int ) m_startup ) ;
2025-07-08 14:28:40 -04:00
}
}
EditorGUILayout . EndHorizontal ( ) ;
}
void ImportSample ( string pipeline , TemplateSRPType srpType )
{
2026-03-14 03:13:10 -04:00
if ( EditorUtility . DisplayDialog ( "Import Sample" , "This will import the samples for" + pipeline . Replace ( " Samples" , "" ) + ", please make sure the pipeline is properly installed and/or selected before importing the samples.\n\nContinue?" , "Yes" , "No" ) )
2025-07-08 14:28:40 -04:00
{
AssetDatabase . ImportPackage ( AssetDatabase . GUIDToAssetPath ( ResourcesGUID ) , false ) ;
switch ( srpType )
{
case TemplateSRPType . BiRP :
{
AssetDatabase . ImportPackage ( AssetDatabase . GUIDToAssetPath ( BuiltInGUID ) , false ) ;
break ;
}
case TemplateSRPType . URP :
{
if ( m_srpSamplePackages . TryGetValue ( ( int ) ASEPackageManagerHelper . CurrentURPBaseline , out ASESRPPackageDesc desc ) )
{
string path = AssetDatabase . GUIDToAssetPath ( desc . guidURP ) ;
if ( ! string . IsNullOrEmpty ( path ) )
{
AssetDatabase . ImportPackage ( AssetDatabase . GUIDToAssetPath ( UniversalGUID ) , false ) ;
AssetDatabase . ImportPackage ( path , false ) ;
}
}
break ;
}
case TemplateSRPType . HDRP :
{
if ( m_srpSamplePackages . TryGetValue ( ( int ) ASEPackageManagerHelper . CurrentHDRPBaseline , out ASESRPPackageDesc desc ) )
{
string path = AssetDatabase . GUIDToAssetPath ( desc . guidHDRP ) ;
if ( ! string . IsNullOrEmpty ( path ) )
{
AssetDatabase . ImportPackage ( AssetDatabase . GUIDToAssetPath ( HighDefinitionGUID ) , false ) ;
AssetDatabase . ImportPackage ( path , false ) ;
}
}
break ;
}
default :
{
// no action
break ;
}
}
}
}
UnityWebRequest www ;
IEnumerator StartRequest ( string url , Action success = null )
{
2026-03-14 03:13:10 -04:00
using ( www = UnityWebRequest . Get ( url ) )
2025-07-08 14:28:40 -04:00
{
yield return www . SendWebRequest ( ) ;
2026-03-14 03:13:10 -04:00
while ( www . isDone = = false )
2025-07-08 14:28:40 -04:00
yield return null ;
2026-03-14 03:13:10 -04:00
if ( success ! = null )
2025-07-08 14:28:40 -04:00
success ( ) ;
}
}
public static void StartBackgroundTask ( IEnumerator update , Action end = null )
{
EditorApplication . CallbackFunction closureCallback = null ;
closureCallback = ( ) = >
{
try
{
2026-03-14 03:13:10 -04:00
if ( update . MoveNext ( ) = = false )
2025-07-08 14:28:40 -04:00
{
2026-03-14 03:13:10 -04:00
if ( end ! = null )
2025-07-08 14:28:40 -04:00
end ( ) ;
EditorApplication . update - = closureCallback ;
}
}
2026-03-14 03:13:10 -04:00
catch ( Exception ex )
2025-07-08 14:28:40 -04:00
{
2026-03-14 03:13:10 -04:00
if ( end ! = null )
2025-07-08 14:28:40 -04:00
end ( ) ;
Debug . LogException ( ex ) ;
EditorApplication . update - = closureCallback ;
}
} ;
EditorApplication . update + = closureCallback ;
}
}
[Serializable]
internal class ChangeLogInfo
{
public int Version ;
public string LastUpdate ;
public static ChangeLogInfo CreateFromJSON ( string jsonString )
{
return JsonUtility . FromJson < ChangeLogInfo > ( jsonString ) ;
}
public ChangeLogInfo ( int version , string lastUpdate )
{
Version = version ;
LastUpdate = lastUpdate ;
}
}
}