codeAPI Reference

s&box ScriptedEntity: Custom entity GameResource

calendar_today May 12, 2026 schedule ~2 min read person PatrickJr verified 50

ScriptedEntity GameResource API Reference

ScriptedEntity is a GameResource that defines a spawnable entity with a prefab, used by the spawn menu to create custom entities.

Type Signature

CSHARP
[AssetType(Name = "Sandbox Entity", Extension = "sent", Category = "Sandbox", Flags = AssetTypeFlags.NoEmbedding | AssetTypeFlags.IncludeThumbnails)]
public class ScriptedEntity : GameResource, IDefinitionResource
{
    [Property]
    public PrefabFile Prefab { get; set; }

    [Property]
    public string Title { get; set; }

    [Property]
    public string Description { get; set; }

    [Property]
    public string Category { get; set; }

    [Property]
    public bool IncludeCode { get; set; }

    [Property]
    public bool Developer { get; set; }

    public override Bitmap RenderThumbnail(ThumbnailOptions options);
    protected override Bitmap CreateAssetTypeIcon(int width, int height);
    public override void ConfigurePublishing(ResourcePublishContext context);
}

Properties

Methods

RenderThumbnail(ThumbnailOptions options)

Renders the prefab as a thumbnail image for the asset browser.

CreateAssetTypeIcon(int width, int height)

Creates the asset type icon (📦) for the editor.

ConfigurePublishing(ResourcePublishContext context)

Configures publishing settings. Disables publishing if prefab is missing. Sets IncludeCode based on the property.

Usage

Create a .sent file to define a custom spawnable entity:

CSHARP
[AssetType(Name = "Sandbox Entity", Extension = "sent", Category = "Sandbox")]
public class MyCustomEntity : ScriptedEntity
{
    [Property]
    public PrefabFile Prefab { get; set; }

    [Property]
    public string Title { get; set; } = "My Custom Entity";

    [Property]
    public string Description { get; set; } = "A custom entity for my game";

    [Property]
    public string Category { get; set; } = "Props";

    [Property]
    public bool IncludeCode { get; set; } = true;
}

Notes

  • File extension is .sent
  • Implements IDefinitionResource for metadata
  • Thumbnail is rendered from the prefab scene
  • Developer entities are hidden in published games
  • Category property controls spawn menu organization
Was this helpful?