public abstract class Sandbox.Resource
A resource loaded in the engine, such as a `Sandbox.Model` or `Sandbox.Material`.
Related Guides
Broader workflow and conceptual references connected to this API.
If you want a specific file/asset type to have a custom Thumbnail/Inspector Preview, you can simply create an AssetPreview. An AssetPreview initializes a SceneWorld and SceneCamera, rendering the Camera to the Preview output, so all you need to do is populate it and/or position the Camera to your liking.
The mount system is extensible - anyone can write a mount to add support for a new game or engine and contribute it to s&box via pull request. A mount detects a game's install directory via Steam, scans its files, and converts assets into s&box compatible assets, all at runtime.
You can define your own custom asset types as GameResources. They give you a nice inspector window and they're hotloaded in-game, which means you can whip things up pretty quickly if you're using them.
Editor Events are events that are broadcast globally throughout the editor and can be listened to/fired from any Editor Project. These are useful for creating your own custom Editor Tools and making sure they can work in tandem with existing systems.
Editor UI is built entirely out of Widgets. Widgets are different from Panels, which are used for in-game UI. Widgets can be various elements or components, such as labels, buttons, text boxes, trees, or images.
ResourceExtensions can be used to append additional data to existing GameResources without modifying the original class or assets. This is useful for adding additional properties to resources such as Clothing, Surfaces, Models, ect.
Constructors
Showing 1 constructors
protected Resource()
No results match this filter.
Methods
Showing 7 methods
public virtual void ConfigurePublishing(Sandbox.ResourcePublishContext context)
When publishing an asset we'll call into this method to allow the resource to configure how it wants to be published. This allows your resource to make bespoke decisions to configure publishing based on its content.
protected virtual Sandbox.Bitmap CreateAssetTypeIcon(int width, int height)
Create an icon for this type of asset. This is an icon that is shown in the editor.
protected static Sandbox.Bitmap CreateSimpleAssetTypeIcon(string icon, int width, int height, System.Nullable`1<Color> background = null, System.Nullable`1<Color> foreground = null)
Parameters
background: Default: nullforeground: Default: null
protected virtual override void Finalize()
public Sandbox.Bitmap GetAssetTypeIcon(int width, int height)
Get the icon for this type of asset. This is an icon that is shown in the editor.
public virtual Sandbox.Bitmap RenderThumbnail(Sandbox.Resource.ThumbnailOptions options)
Render a thumbnail for this specific resource.
public virtual void StateHasChanged()
Should be called after the resource has been edited by the inspector
No results match this filter.
Properties
Showing 6 properties
public System.Nullable`1<Sandbox.Resources.EmbeddedResource> Sandbox.Resource.EmbeddedResource { get; set; }
Embedded data for this resource
public virtual bool Sandbox.Resource.HasUnsavedChanges { get; set; }
True if this resource has been changed but the changes aren't written to disk
public virtual bool Sandbox.Resource.IsValid { get; set; }
public int Sandbox.Resource.ResourceId { get; set; }Obsolete
ID of this resource,
Obsolete: ResourceId is obsolete and will be removed in the future.
public string Sandbox.Resource.ResourceName { get; set; }
File name of the resource without the extension.
public string Sandbox.Resource.ResourcePath { get; set; }
Path to this resource.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.Resource |