Asset definition for the Hoverball tool. Declares a GameResource with prefab, title and description, renders an editor thumbnail by rendering the prefab scene to a bitmap, and provides a simple emoji-based asset type icon.
[AssetType( Name = "Sandbox Hoverball", Extension = "hdef", Category = "Sandbox", Flags = AssetTypeFlags.NoEmbedding | AssetTypeFlags.IncludeThumbnails )]
public class HoverballDefinition : GameResource, IDefinitionResource
{
[Property]
public PrefabFile Prefab { get; set; }
[Property]
public string Title { get; set; }
[Property]
public string Description { get; set; }
public override Bitmap RenderThumbnail( ThumbnailOptions options )
{
if ( Prefab is null ) return default;
var bitmap = new Bitmap( options.Width, options.Height );
bitmap.Clear( Color.Transparent );
SceneUtility.RenderGameObjectToBitmap( Prefab.GetScene(), bitmap );
return bitmap;
}
protected override Bitmap CreateAssetTypeIcon( int width, int height )
{
return CreateSimpleAssetTypeIcon( "🎱", width, height, "#46b4e8" );
}
}