sbox-issues
sbox-issues copied to clipboard
Cloud.Asset<T>
For?
S&Box
What can't you do?
Cloud.Material and Cloud.Model are very convenient but not always what I want. Previously I asked for Cloud.Texture https://github.com/Facepunch/sbox-issues/issues/5420, but that was before every possible asset type became publishable.
So I tried to make my own cloud asset shorthand but I expectedly ran into the problem of Cloud.Asset only allowing string literals.
How would you like it to work?
Cloud.Asset<T>could be very powerful, but a lot of assets need to be converted to be useful (e.g PrefabFile into PrefabScene).- A way to make our own methods like Cloud.Prefab. Potentially make Cloud.CloudAssetProviderAttribute public?
What have you tried?
public static class CloudExtensions
{
public static PrefabScene Prefab( [StringLiteralOnly] string ident )
{
var path = Cloud.Asset( ident );
var file = ResourceLibrary.Get<PrefabFile>( path );
return SceneUtility.GetPrefabScene( file );
}
}
Additional context
No response