GameResourceclass

Assets defined in C# and created through tools. You can define your own Custom Asset Types.

objectResourceGameResource
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public abstract class Sandbox.GameResource : Sandbox.Resource

Constructors1

Showing 1 constructors

Methods9

Showing 9 methods

public void Deserialize(System.Text.Json.Nodes.JsonObject jso)PUBLIC

Deserialize values from a JsonObject

ParameterTypeDescription
jsoJsonObject
Returns:void

public System.Collections.Generic.IEnumerable`1<string> GetReferencedPackages()PUBLIC

Get a list of packages that are needed to load this asset

Returns:IEnumerable<string>

public void LoadFromJson(string json)PUBLIC

ParameterTypeDescription
jsonstring
Returns:void

protected virtual void OnDestroy()PROTECTEDVIRTUALLIFECYCLE

Called when this resource is being unloaded. Clean up any resources owned by this instance here.

Returns:void

protected virtual void OnJsonSerialize(System.Text.Json.Nodes.JsonObject node)PROTECTEDVIRTUAL

Called after we serialize, allowing you to store any extra or modify the output.

ParameterTypeDescription
nodeJsonObject
Returns:void

protected virtual void PostLoad()PROTECTEDVIRTUAL

Called when the asset is first loaded from disk.

Returns:void

protected virtual void PostReload()PROTECTEDVIRTUAL

Called when the asset is recompiled/reloaded from disk.

Returns:void

public System.Text.Json.Nodes.JsonObject Serialize()PUBLIC

Serialize the current state to a JsonObject

Returns:JsonObject

public virtual sealed void StateHasChanged()PUBLICVIRTUAL

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

Returns:void

Properties5

Showing 5 properties

protected virtual object Sandbox.GameResource.ActionGraphTarget { get; set; }PROTECTEDVIRTUALGETSET

Target instance used for any action graphs contained in this resource. Defaults to this resource itself.

Returns:object

protected virtual System.Type Sandbox.GameResource.ActionGraphTargetType { get; set; }PROTECTEDVIRTUALGETSET

Target type used for any action graphs contained in this resource. Defaults to this resource's type.

Returns:Type

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

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

Returns:bool

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

Returns:bool

public virtual int Sandbox.GameResource.ResourceVersion { get; set; }PUBLICVIRTUALGETSET

The version of the component. Used by `Sandbox.JsonUpgrader`.

Returns:int

On this page