s&box docs

public abstract class Sandbox.GameResource : Sandbox.Resource

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

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

Methods

Showing 9 methods

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

Deserialize values from a JsonObject

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

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

public void LoadFromJson(string json)

protected virtual void OnDestroy()

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

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

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

protected virtual void PostLoad()

Called when the asset is first loaded from disk.

Implementations

protected virtual void PostReload()

Called when the asset is recompiled/reloaded from disk.

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

Serialize the current state to a JsonObject

public virtual sealed void StateHasChanged()

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

Properties

Showing 5 properties

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

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

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

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

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

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

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

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

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

Metadata

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

On this page