Exemple #1
0
        static void LoadThemeAssetDefinitionState(ThemeAssetDefinitionState extraData, string assetPath)
        {
            extraData.StyleSheets     = new List <StyleSheet>();
            extraData.InheritedThemes = new List <ThemeStyleSheet>();
            var styleSheet = AssetDatabase.LoadAssetAtPath <StyleSheet>(assetPath);

            foreach (var importStruct in styleSheet.imports)
            {
                if (importStruct.styleSheet is ThemeStyleSheet themeStyleSheet)
                {
                    extraData.InheritedThemes.Add(themeStyleSheet);
                }
                else
                {
                    extraData.StyleSheets.Add(importStruct.styleSheet);
                }
            }
        }
Exemple #2
0
        static void LoadThemeAssetDefinitionState(ThemeAssetDefinitionState extraData, string assetPath)
        {
            extraData.StyleSheets     = new List <StyleSheet>();
            extraData.InheritedThemes = new List <ThemeStyleSheet>();
            var styleSheet = AssetDatabase.LoadAssetAtPath <StyleSheet>(assetPath);

            // styleSheet will be null if the asset has been deleted while the editor was opened
            if (styleSheet != null)
            {
                foreach (var importStruct in styleSheet.imports)
                {
                    if (importStruct.styleSheet is ThemeStyleSheet themeStyleSheet)
                    {
                        extraData.InheritedThemes.Add(themeStyleSheet);
                    }
                    else
                    {
                        extraData.StyleSheets.Add(importStruct.styleSheet);
                    }
                }
            }
        }