Resourceclass

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

object→Resource
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public abstract class Sandbox.Resource

Constructors1

Showing 1 constructors

protected Resource()PROTECTEDCONSTRUCTOR

Methods7

Showing 7 methods

public virtual void ConfigurePublishing(Sandbox.ResourcePublishContext context)PUBLICVIRTUAL

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.

ParameterTypeDescription
contextResourcePublishContext—
Returns:void—

protected virtual Sandbox.Bitmap CreateAssetTypeIcon(int width, int height)PROTECTEDVIRTUAL

Create an icon for this type of asset. This is an icon that is shown in the editor.

ParameterTypeDescription
widthint—
heightint—
Returns:Bitmap—

protected static Sandbox.Bitmap CreateSimpleAssetTypeIcon(string icon, int width, int height, System.Nullable`1<Color> background = null, System.Nullable`1<Color> foreground = null)PROTECTEDSTATIC

ParameterTypeDescription
iconstring—
widthint—
heightint—
background = nullNullable<Color>—
foreground = nullNullable<Color>—
Returns:Bitmap—

protected virtual override void Finalize()PROTECTEDVIRTUALOVERRIDE

Returns:void—

public Sandbox.Bitmap GetAssetTypeIcon(int width, int height)PUBLIC

Get the icon for this type of asset. This is an icon that is shown in the editor.

ParameterTypeDescription
widthint—
heightint—
Returns:Bitmap—

public virtual void StateHasChanged()PUBLICVIRTUAL

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

Returns:void—

Properties7

Showing 7 properties

public virtual bool Sandbox.Resource.HasUnsavedChanges { get; set; }PUBLICVIRTUALGETSET

True if this resource has been changed but the changes aren't written to disk

Returns:bool—

public virtual bool Sandbox.Resource.IsError { get; set; }PUBLICVIRTUALGETSET

Returns:bool—

public virtual bool Sandbox.Resource.IsValid { get; set; }PUBLICVIRTUALGETSET

Returns:bool—

public int Sandbox.Resource.ResourceId { get; set; }PUBLICGETSETOBSOLETE

ID of this resource,

Obsolete: ResourceId is obsolete and will be removed in the future.

Returns:int—

public string Sandbox.Resource.ResourceName { get; set; }PUBLICGETSET

File name of the resource without the extension.

Returns:string—

public string Sandbox.Resource.ResourcePath { get; set; }PUBLICGETSET

Path to this resource.

Returns:string—

On this page