|
Window Framework v1.2.4
Window Framework for Unity UI Toolkit
|
@import url("unity-theme://default"); Also, you really only need one of these files since when you have several, you get duplication in lists with references to the 'default' stylesheet. This is happens because each Runtime theme imports it as a separate instance. Since they are all imports, they are all the same file but having errant file links floating around may cause them to break later during some random cleanup of your project. Also, Unity stylesheet links are kind of touchy in that any changes in anem or path will cause the reference to break. There are several options at this point, you can make yet another file to hold the global styles that you can then link as an aditional import in this file, or you can place global definitions directly in the theme file itself since it is also treated as a stylesheet. We recomend you use the USS variable system and place all variable powered theme elements here along with a link to a default values style sheet.
The Standard TSS Theme file, as stated before is the same as a runtime theme file without the @import call to the default Unity theme file. In the window framework, one (1) os these are recomended for each theme in the system. This file will also be the one listed in the Theme dropdown available in UI Builder so choose a memerable name or follow some sort of naming convention. We recomend WFW-[ThemeName]Theme for the Theme filename with [Theme] replaced with your theme name. This file will be used to link the runtime theme, current theme settings and any other items you want to include with the final theme together as shown in the recomended layout image.
Assets/Resources/Themes as this location would be outside of the asset and descriptive of its purpose based on location but you can use any folder that best suits your project layout. The only major requirments being that: Resources folder so that Resources.Load() calls can operate properly Decide to use our Runtime or Your Own
MyProjectDefaultTheme WFW-MyProjectDefaultTheme
CTRL+D to make a copy, the new file will have a 1 added to the end. WFW-MyProjectDefaultThemeSettings Link the files in the Theme Stylsheet
WFW-MyProjectDefaultTheme file and look in the inspector. your will need to link all the files needed to make up a usable theme as shown in the image, using this example. Note that the WFW-DefaultRuntimeTheme in inherited, this is required so that all the base styling applications are loaded. The Settings file we coppied has only the values that are needed by the Runtime file. Make sure to click Apply to save the data file (Unity stylesheets settings made in the inspector are not dynamically updated) Once everything is linked up you will be able to see your new theme in the UI Bulder Themes dropdown list but you will still need a data file to use it in the Window Framework at runtime. One more thing to note is that Unity Theme StyleSheets do not like being moved OR having the linked files moved, if they are the links break and have to be recreated. We have decided to make our runtime theme location and naming a static part of our asset going forward so that you can build integrations with reasonible reliability that the files will be there. [ElementName]__[USS-Styling-Option]–windowFrame__border-width: 5px; // effect all borders–windowFrame__border-top-width: 5px; // effect top border only WindowFrameworkStylingTemplate.uxml file that has a single window loaded, take note of the window options that are available on the right hand inspector. Some of these settings need a runtime environment to work but other like size and header, footer options all work.UXMLBasedDemoWindow.cs file in the Demo/Scripts folder can be used as an example of creating window frames as a partial class UXML Element.
WindowFrameController.OnThemeChanged event and let that update your stylesheets.