---
title: "TypeSelect - s&box library"
description: "A editor tool that adds a [TypeSelector] attribute, enabling easy selection of inherited types in the inspector."
canonical: "https://sbox.watch/zh-cn/libraries/thedimin/typeselect/"
generated_at: "2026-11-27T17:17:25.389Z"
---

# TypeSelect

A editor tool that adds a \[TypeSelector\] attribute, enabling easy selection of inherited types in the inspector.

- 类型: 库
- 标识符: thedimin.typeselect
- 创作者: thedimin
- 规范地址: https://sbox.watch/zh-cn/libraries/thedimin/typeselect/
- Markdown: https://sbox.watch/zh-cn/libraries/thedimin/typeselect/index.md
- sbox.game: https://sbox.game/thedimin/typeselect/
- 生成时间: 2026-11-27T17:17:25.389Z

## 统计

- 24小时热度: +0
- Terry 评分: 43%
- 收藏: 0
- 好评: 2
- 差评: 0
- 更新时间: 2025年3月17日
- 创建时间: 2025年3月17日
- 大小: 3.6 KB
- 文件: 6
- 标签: attribute, attributes, development, easy, editor, extension, polymorphism, reflection

## 描述

About
Type select adds \`\[TypeSelector\]\` attribute putting this on a property will allow you to select an inherited type in the editor as shown here:

WARNING
to make sure your types get serialized correctly you need to make use of the \`\[JsonPolymorphic\]\` and \`\[JsonDerivedType\]\` attributes.
And for the latter make sure to set a typeDiscirimnator or it wil not work !!!!

EXAMPLE CODE

\[GameResource( "Quest", "quest", "A quest given to the user !", Category = "quest" )\]
public class Quest : GameResource
{
 \[Property,InlineEditor,TypeSelector\] public TaskBase Task { get; set; }
}

//The two attributes here are from .net

\[JsonPolymorphic\]
\[JsonDerivedType( typeof(Collect), "Collect" )\] // Yeah you have to do this for every type. blame C\#, not me.
public abstract class TaskBase //Because this class is abstract it will not showup in the menu.
{
 \[Property\] public string QuestName {get;set};// all types will show this
}

public class Collect : TaskBase
{
 \[Property\] public int AmountToCollect {get;set;}
}

public class TalkTo : TaskBase
{
 \[Property\] public GameObject Target {get;set;}
}TODO
 ☐ Search functionality in the menu



## More by thedimin

| Package | 标识符 | 玩家 | 收藏 | 好评 | 评分 | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Global Chat | thedimin.global_chat | 0 | 0 | 1 | 27% | https://sbox.watch/zh-cn/libraries/thedimin/global_chat/index.md |
