Skip to content

Commit b256f6a

Browse files
committed
New TypeGrouping option - ByFlatName, can be used to simplify types label in the TypeField
1 parent 074e06b commit b256f6a

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

Assets/Editor Toolbox/Editor/Internal/TypesEditorCollection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ private static string FormatGroupedTypeName(Type type, TypeGrouping grouping)
7979
}
8080

8181
return "Scripts/" + type.FullName.Replace('.', '/');
82+
83+
case TypeGrouping.ByFlatName:
84+
return type.Name;
8285
}
8386
}
8487

Assets/Editor Toolbox/Runtime/Attributes/Regular/TypeConstraintAttribute.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ public enum TypeGrouping
134134
/// grouping method must only be used for <see cref="MonoBehaviour"/> types.
135135
/// </summary>
136136
ByAddComponentMenu,
137+
/// <summary>
138+
/// Only name of the <see cref="Type"/>.
139+
/// </summary>
140+
ByFlatName
137141
}
138142

139143
/// <summary>

Assets/Examples/Scenes/SampleScene.unity

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,8 @@ MonoBehaviour:
974974
typeReference:
975975
type4:
976976
typeReference: UnityEngine.BoxCollider, UnityEngine.PhysicsModule
977+
type5:
978+
typeReference: UnityEngine.TerrainCollider, UnityEngine.TerrainPhysicsModule
977979
scene1:
978980
sceneReference: {fileID: 102900000, guid: f11034f4657f51a47aac14f26410c500, type: 3}
979981
sceneName: SampleScene

Assets/Examples/Scripts/SampleBehaviour5.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class SampleBehaviour5 : MonoBehaviour
1515
public SerializedType type3;
1616
[TypeConstraint(typeof(Collider), AllowAbstract = false, AllowObsolete = false, TypeSettings = TypeSettings.Class, TypeGrouping = TypeGrouping.None)]
1717
public SerializedType type4;
18+
[TypeConstraint(typeof(Collider), AllowAbstract = false, AllowObsolete = false, TypeSettings = TypeSettings.Class, TypeGrouping = TypeGrouping.ByFlatName)]
19+
public SerializedType type5;
1820

1921
[Label("Serialized Scene", skinStyle: SkinStyle.Box)]
2022

0 commit comments

Comments
 (0)