s&
About
The Project
info
About s&box
map
Roadmap
monitoring
Metrics
Engine startup and usage numbers
Updates
newspaper
Latest News
published_with_changes
Changes
Release-by-release changelog
Games
Browse Games
Discover Games
gamejams
voting
Game Jam III
Ends
Fri 25 Sep
Theme
One More Round
Voting is open. Play the entries and pick the winner.
£
50,000
prizepool
View the jam
Workshop
Playable
sports_esports
Games
Standalone games and gamemodes
Assets
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
apps
Everything
Every asset type in one list
Forum
Learn
Documentation
rocket_launch
Getting Started
docs
Documentation
api
API Reference
Resources
school
Tutorials
manage_search
Code Search
Get s&box
Sign in with Steam
Api
Classes
ResourceGenerator
chevron_left
Classes
class
ResourceGenerator
Constructors
lock
ResourceGenerator
Properties
data_object
CacheToDisk
Methods
functions
Deserialize
functions
FindOrCreateObject
functions
FindOrCreateObjectAsync
functions
GetHash
Static Methods
functions
Create
functions
CreateResource
ResourceGenerator
Creates a resource from a json definition
class
Sandbox.Resources
.
abstract
Sandbox.Engine
build
Constructors
1
ResourceGenerator
(
)
data_object
Properties
1
CacheToDisk
bool
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.
functions
Methods
4
Deserialize
(
obj
)
Copy properties from obj to us
FindOrCreateObject
(
options
)
Resource
Find or create the resource (blocking)
FindOrCreateObjectAsync
(
options
,
token
)
ValueTask`1
If we generated this before, then find the current cache'd value. If not, then generate a new one.
GetHash
(
)
UInt64
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.
functions
Static Methods
2
Create
(
generatorName
)
ResourceGenerator`1
Create a ResourceGenerator by name
CreateResource
(
obj
,
options
)
T
Inheritance
ResourceGenerator
ResourceGenerator<T>
TextureGenerator
ColorTextureGenerator
ImageFileGenerator
LinearGradient
RadialGradient
RandomTextureGenerator
RenderTextureAssetGenerator
SvgSourceGenerator
TextTextureGenerator
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.