-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public class Asset<H extends Object> implements AutoCloseable
Base class for assets managed by a RiveWorker.
Uses ops to perform operations specific to the asset type.
Each asset holds a reference to its RiveWorker. When creating assets manually, call close when you no longer need the asset; releasing the worker alone is not enough to purge asset or worker memory while the asset remains open. Closing the asset does not unregister its keys; unregister them explicitly, preferably before calling close.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAsset.Companion
-
Method Summary
-
-
Method Detail
-
close
Unit close()
Closes this asset and schedules deletion on its Rive worker.
Closing does not unregister keys registered through this asset. Prefer to unregister them before closing; unregister remains available afterward while the worker is open. Repeated calls are safe and have no effect after the first call.
-
register
final Unit register(String key)
Register the asset with the given key. When Rive fulfills a referenced asset, it will look for an asset registered under that key. The key comes from the zip file created when exporting a Rive file.
Be sure to unregister the key with unregister when it is no longer needed, preferably before calling close.
- Parameters:
key- The key to register the asset under.
-
unregister
final Unit unregister(String key)
Unregister the asset with the given key.
This worker-level cleanup does not require the asset handle and remains available after close, provided the owning worker is still open.
- Parameters:
key- The key to unregister the asset from.
-
-
-
-