Attributes
JSON Attributes¶
Some users have provided feedback that renaming class names and field names is currently quite annoying because it has to be done manually by editing the serialized JSON. So, in v2.2.0, we introduce these attributes to make renaming class names and field names easier and faster.
Info
You can use these attributes for input, input normalizations, action tasks and target filters.
ClassFormerlySerializedAs¶
To change a class name from CarlosLab.OldNamespace.OldActionTask
to CarlosLab.NewNamespace.NewActionTask
, you need to pass the old class name and the old namespace to the constructor of ClassFormerlySerializedAs
:
namespace CarlosLab.NewNamespace
{
[ClassFormerlySerializedAs(oldClassName:"OldActionTask", oldNamespace:"CarlosLab.OldNamespace")]
public class NewActionTask : ActionTask
{
}
}
If the namespace remains unchanged, you only need to pass the old class name:
namespace CarlosLab.Unchanged
{
[ClassFormerlySerializedAs(oldClassName:"OldActionTask")]
public class NewActionTask : ActionTask
{
}
}
FieldFormerlySerializedAs¶
To change a field name from OldField
to NewField
, you need to pass the old field name to the constructor of FieldFormerlySerializedAs
:
public class NewActionTask : ActionTask
{
[FieldFormerlySerializedAs("OldField")]
public int NewField;
}
Field Attributes¶
We have received feedback that it’s currently hard to read our classes as they become more complex and have a lot of fields. So, in v2.2.0, we added these attributes to help you organize your fields in the Intelligence Editor.
Info
You can use these attributes in input, input normalizations, action tasks and target filters.
BoxGroup & FoldoutGroup¶
BoxGroup
and FoldoutGroup
attributes are used to group fields in the Intelligence Editor.
public class TestGroupTask : ActionTask
{
[BoxGroup("Group1")]
public string Field1;
[BoxGroup("Group1")]
public int Field2;
[BoxGroup("Group1")]
public float Field3;
[FoldoutGroup("Group2")]
public string Field4;
[FoldoutGroup("Group2")]
public int Field5;
[FoldoutGroup("Group2")]
public float Field6;
}
Here’s how it looks in the Intelligence Editor:
ShowIf & HideIf¶
ShowIf
and HideIf
attributes are used to show/hide fields in the Intelligence Editor. These attributes allow users to display fields based on conditions. You can use them for basic types, such as bool
, enum
, string
, float
, and int
.
Here are examples of how to use these attributes with bool
type and enum
type:
Bool¶
public class TestBoolTask : ActionTask
{
public bool Toggle;
[ShowIf("Toggle")]
public int ShowIfToggleDefault;
[ShowIf("Toggle", true)]
public float ShowIfToggleTrue;
[ShowIf("Toggle", false)]
public int ShowIfToggleFalse;
[HideIf("Toggle")]
public float HideIfToggleDefault;
[HideIf("Toggle", true)]
public float HideIfToggleTrue;
[HideIf("Toggle", false)]
public int HideIfToggleFalse;
}
Here’s how it looks in the Intelligence Editor:
Enum¶
public enum TestEnum
{
Type1,
Type2,
Type3,
}
public class TestEnumTask : ActionTask
{
public TestEnum Type;
[ShowIf("Type")]
public bool ShowIfTypeDefault;
[ShowIf("Type", TestEnum.Type1)]
public bool ShowIfType1;
[ShowIf("Type", TestEnum.Type2)]
public float ShowIfType2;
[ShowIf("Type", TestEnum.Type3)]
public int ShowIfType3;
[HideIf("Type")]
public bool HideIfTypeDefault;
[HideIf("Type", TestEnum.Type1)]
public bool HideIfType1;
[HideIf("Type", TestEnum.Type2)]
public float HideIfType2;
[HideIf("Type", TestEnum.Type3)]
public int HideIfType3;
}
Here’s how it looks in the Intelligence Editor:
Category Attribute¶
Category
attribute is used to group your classes into categories. You can check how to use it here: Category Attribute.
If you like Utility Intelligence, please consider supporting it by leaving a 5-star review on the Asset Store.
Your positive feedback motivates me to keep improving and delivering more updates for this framework.
Thank you so much for your support. I love you all! 🥰

Created : October 15, 2024