public abstract class Sandbox.Resources.ResourceGenerator
Creates a resource from a json definition
Constructors
Showing 1 constructors
protected ResourceGenerator()
No results match this filter.
Methods
Showing 8 methods
public virtual void Deserialize(System.Text.Json.Nodes.JsonObject obj)
Copy properties from obj to us
public virtual Sandbox.Resource FindOrCreateObject(Sandbox.Resources.ResourceGenerator.Options options)
Find or create the resource (blocking)
public virtual System.Threading.Tasks.ValueTask`1<Sandbox.Resource> FindOrCreateObjectAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)
If we generated this before, then find the current cache'd value. If not, then generate a new one.
public virtual ulong GetHash()
Returns a hash to be used when loading/saving. We use this to determine if the resource has changed. By default we serialize the generator to a json string and return the CRC64 of that value. You can override this in your generator if you need to make it faster, or ignore some stuff.
No results match this filter.
Properties
Showing 1 properties
public virtual bool Sandbox.Resources.ResourceGenerator.CacheToDisk { get; set; }
If true then the generation will create a real resource and store it on disk. Use this if creating the resource takes a while, or you won't be shipping the generator with the game, or if it relies on data that won't be available in the shipped game.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox.Resources |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.Resources.ResourceGenerator |