Component:AssetLoader: Difference between revisions

From Resonite Wiki
mNo edit summary
remove "fake user", cleanup
 
Line 6: Line 6:
|Name=Asset Loader`1
|Name=Asset Loader`1
}}
}}
'''AssetLoader''' is a Component that is used to tell the game that an asset is still being used. This is helpful for when an asset is referenced in a way that deletes it during asset cleanup or during save. This component will prevent the asset from being cleaned up because it has a fake user.  
'''AssetLoader''' is a Component that is used to tell the game that an [[Asset]] is still being used. This is helpful for when an asset is referenced in a way that deletes it during asset cleanup and saving.  


<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Asset|{{RootFieldType|AssetRef`1|A}}|TypeAdv0=true| The [[Type:IAsset`1|Asset]] to give a fake user.
|Asset|{{RootFieldType|AssetRef`1|A}}|TypeAdv0=true| The [[Type:IAsset`1|Asset]] to keep loaded.
}}
}}


Line 17: Line 17:
== Usage ==
== Usage ==


When attaching component, specify any [[Type:IAsset`1|Asset]] type by name, and then insert an asset of that type into the asset field to give it a fake user.
Set the <code>Asset</code> field to the [[asset]] that should be kept around, afterwards the asset should not be cleaned up as long as it continues to be referenced by the AssetLoader.


<!--T:4-->
<!--T:4-->

Latest revision as of 00:12, 15 April 2025

Component image 
Asset Loader`1 component as seen in the Scene Inspector

AssetLoader is a Component that is used to tell the game that an Asset is still being used. This is helpful for when an asset is referenced in a way that deletes it during asset cleanup and saving.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't.
Asset A The Asset to keep loaded.

Usage

Set the Asset field to the asset that should be kept around, afterwards the asset should not be cleaned up as long as it continues to be referenced by the AssetLoader.

Examples

Images on fake badges, some UIX elements.

Related Components