codeAPI Reference

s&box LineDefinition: Trail line resource

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

LineDefinition GameResource API Reference

LineDefinition is a GameResource for trail line definitions used by the Trail tool. It implements IDefinitionResource and configures material properties for line rendering.

Type Signature

CSHARP
[AssetType(Name = "Sandbox Line", Extension = "ldef", Category = "Sandbox", Flags = AssetTypeFlags.NoEmbedding | AssetTypeFlags.IncludeThumbnails)]
public class LineDefinition : GameResource, IDefinitionResource
{
    [Property]
    public string Title { get; set; }

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

    [Property, Group("Material")]
    public Material Material { get; set; }

    [Property, Group("Material")]
    public bool WorldSpace { get; set; } = true;

    [Property, Range(1, 128), Group("Material")]
    public float UnitsPerTexture { get; set; } = 32.0f;

    [Property, Group("Material")]
    public bool Opaque { get; set; } = true;

    [Property, Group("Material")]
    public BlendMode BlendMode { get; set; }

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

Properties

Methods

RenderThumbnail(ThumbnailOptions options)

Renders a thumbnail from the material's color texture, or a white bitmap if no material.

CreateAssetTypeIcon(int width, int height)

Creates the asset type icon with a sparkle emoji and blue color.

Usage

CSHARP
[AssetType(Name = "Sandbox Line", Extension = "ldef", Category = "Sandbox")]
public class MyLineDefinition : LineDefinition
{
    [Property]
    public Material Material { get; set; } = "materials/lines/my_line.vmat";

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

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

    [Property]
    public float UnitsPerTexture { get; set; } = 64.0f;
}

Notes

  • Used by the Trail tool for creating custom line types
  • Material should have a "g_tColor" texture for thumbnail rendering
  • UnitsPerTexture controls texture tiling along the line
  • WorldSpace determines if the line is affected by camera movement
  • BlendMode controls transparency/additive blending
Was this helpful?