s&box docs

public abstract class Sandbox.Resource

A resource loaded in the engine, such as a `Sandbox.Model` or `Sandbox.Material`.

Broader workflow and conceptual references connected to this API.

Asset Previews

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.

Creating Mounts

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.

Custom Assets

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

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 Widgets

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.

GameResource Extensions

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

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: null
  • foreground: 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 void StateHasChanged()

Should be called after the resource has been edited by the inspector

Properties

Showing 6 properties

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.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Resource

On this page