GameResourceclass
Assets defined in C# and created through tools. You can define your own Custom Asset Types.
Constructors1
Showing 1 constructors
protected GameResource()
No results match this filter.
Methods12
Showing 12 methods
public void CopyFrom(Sandbox.GameResource source)
Copy the serialized state of another resource into this one, including binary blob data.
| Parameter | Type | Description |
|---|---|---|
| source | GameResource | — |
void—public void Deserialize(System.Text.Json.Nodes.JsonObject jso)
Deserialize values from a JsonObject
| Parameter | Type | Description |
|---|---|---|
| jso | JsonObject | — |
void—public System.Collections.Generic.IEnumerable`1<string> GetReferencedPackages()
Get a list of packages that are needed to load this asset
IEnumerable<string>—public static T Load(string filename)
Loads a game resource by path, including mount:// paths.
Note
Uncached mounted resources load synchronously and must be resolved on the main thread.
| Parameter | Type | Description |
|---|---|---|
| filename | string | — |
T—public void LoadFromJson(string json)
| Parameter | Type | Description |
|---|---|---|
| json | string | — |
void—protected virtual void OnDestroy()
Called when this resource is being unloaded. Clean up any resources owned by this instance here.
void—protected virtual void OnJsonDeserialize(System.Text.Json.Nodes.JsonObject node)
Called before deserialization, allowing optional state to be reset when its fields are absent.
| Parameter | Type | Description |
|---|---|---|
| node | JsonObject | — |
void—protected virtual void OnJsonSerialize(System.Text.Json.Nodes.JsonObject node)
Called after we serialize, allowing you to store any extra or modify the output.
| Parameter | Type | Description |
|---|---|---|
| node | JsonObject | — |
void—protected virtual void PostLoad()
Called when the asset is first loaded from disk.
void—protected virtual void PostReload()
Called when the asset is recompiled/reloaded from disk.
void—public System.Text.Json.Nodes.JsonObject Serialize()
Serialize the current state to a JsonObject
JsonObject—public virtual sealed void StateHasChanged()
Should be called after the resource has been edited by the inspector
void—No results match this filter.
Properties6
Showing 6 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.
object—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
bool—public bool Sandbox.GameResource.IsRemote { get; set; }
True if this resource was loaded from a mounted remote (cloud) package rather than the local project.
bool—public virtual sealed bool Sandbox.GameResource.IsValid { get; set; }
bool—public virtual int Sandbox.GameResource.ResourceVersion { get; set; }
The version of the component. Used by `Sandbox.JsonUpgrader`.
int—No results match this filter.