Class ScyllaEditorAssets
Loads editor-only assets from whichever of the two places Scylla is installed in.
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public static class ScyllaEditorAssets
Remarks
Scylla runs either from its own development project, where everything sits under
Assets/, or from an installed UPM package, where the same file sits under
Packages/<name>/. Editor code that loads a stylesheet or an icon by path has
to work in both, and a path that only covers the first works perfectly right up until
someone installs the package.
Static and assembly-parameterized rather than a base-class method, because the callers that need it are not all windows. A control that carries its own stylesheet is not a window and should not have to become one to load a file.
Methods
AddStyleSheet(VisualElement, string, Assembly)
Adds a stylesheet to an element, warning once if it could not be found.
Declaration
public static bool AddStyleSheet(VisualElement element, string assetPath, Assembly owner)
Parameters
| Type | Name | Description |
|---|---|---|
| VisualElement | element | The element to style. |
| string | assetPath | Path relative to |
| Assembly | owner | An assembly belonging to the module that owns the stylesheet. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
Adding the same stylesheet twice is a no-op in UI Toolkit, so a control may call this on every instance without checking whether a host already loaded it.
Load<T>(string, Assembly, out string)
Loads an editor asset, trying the development project first and the installed package second.
Declaration
public static T Load<T>(string assetPath, Assembly owner, out string probedPaths) where T : Object
Parameters
| Type | Name | Description |
|---|---|---|
| string | assetPath | Path relative to |
| Assembly | owner | An assembly belonging to the module that owns the asset, used to find its package. Pass the calling type's assembly. |
| string | probedPaths | The locations tried, for a diagnostic when nothing was found. |
Returns
| Type | Description |
|---|---|
| T | The asset, or |
Type Parameters
| Name | Description |
|---|---|
| T | The asset type, for example |