codeAPI Reference

s&box ResourceSelectAttribute: Resource picker configuration

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

ResourceSelectAttribute API Reference

ResourceSelectAttribute is used to configure resource selection UI for properties in the inspector.

Type Signature

CSHARP
namespace Sandbox.UI;

public sealed class ResourceSelectAttribute : System.Attribute
{
    public string Extension { get; set; }
    public bool AllowPackages { get; set; }
}

Properties

Usage

Apply ResourceSelectAttribute to a property to configure the resource picker UI:

CSHARP
public class MyComponent : Component
{
    [Property, ResourceSelect(Extension = "vmdl", AllowPackages = true)]
    public Model Model { get; set; }

    [Property, ResourceSelect(Extension = "vmat")]
    public Material Material { get; set; }

    [Property, ResourceSelect(Extension = "prefab", AllowPackages = false)]
    public PrefabFile Prefab { get; set; }
}

Notes

  • Used by the inspector to show a resource picker button for the property
  • Extension filters the resource picker to show only matching file types
  • AllowPackages controls whether package resources can be selected
  • Common extensions: "vmdl" (models), "vmat" (materials), "prefab" (prefabs), "vmdl_c" (compiled models)
  • If AllowPackages is false, only local project resources are shown
Was this helpful?