View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.5.2
- Last updated
- First released
- Unity version
- 2022.3.62 or later
- Package size
- 187 KB
- Files
- 87
- Favorites
- 63
- Views in the past week
- 60
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- Free on
Keywords
Serialize Reference Editor
Convenient proprty drawer for fields marked with the SerializeReference attribute for serializing custom data types into Prefabs and Scriptable Objects.
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAsset preview
1 / 8
Serialize Reference Editor screenshot 1
About this asset
Note: Unity 6+ support.
Serialize Reference Editor is a powerful Unity tool that solves the critical challenge of working with SerializeReference attribute by providing an intuitive interface for editing complex polymorphic data directly in the Unity Inspector.
Key Features:
- Convenient editing of SerializeReference objects using SRAttribute and SRNameAttribute
- Support for lists, arrays, and nested data structures
- Flexible rule system for customizing object creation
- Built-in MissingTypesValidator for detecting missing types
- Customizable type names and hierarchy display for improved navigation
Perfect for:
- Developing systems with polymorphic data
- Creating editor tools
- Working with modular architecture
- Managing game configurations
Saves development time and reduces errors when working with serialized data. Compatible with Unity 2021.3 and later.
From the publisher's Asset Store listing.
Technical details
Main types
SRAttribute
Use it to mark the fields that you want to edit. Important note - they should also be marked with the SerializeReference attribute. You can mark the base type (including the interface) with it.
Allows you to change an array, a list, and a single element. Displays the current field type.
Example:
[SerializeReference]
[SR]
public List<AbstractData> DataList = new List<AbstractData>();
Additional features
You can override SRAttribute and implement a rule for processing instantiated objects.
You can see an example in SRDemoAttribute.cs, where the OnCreate method was overriden:
public override void OnCreate(object instance)
{
if(instance is AbstractData)
{
((AbstractData)instance).DataName = instance.GetType().Name;
}
}
SRNameAttribute
Mark classes with them if you want to customize the display name and nesting hierarchy in the search tree for a specific type.
Example:
[SRName("Data/Simple types/Float")]
public class FloatData : AbstractData
{
[Range(0f, 1f)]
public float Float;
}
You can modify the display settings for the class name without specifying an attribute by navigating to Edit -> Project Settings -> SREditor.
SRHidden attribute
Mark classes with this attribute to hide them from the type selection menu. Types with this attribute will not appear in the search tree.
SRDrawer
A key utility class for rendering SerializeReference fields with enhanced functionality.
Example:
[CustomPropertyDrawer(typeof(CustomData))]
public class CustomDataDrawer : PropertyDrawer
{
private SRDrawer _drawer = new();
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var dataProperty = property.FindPropertyRelative("Data");
_drawer.Draw(position, dataProperty, label);
}
}
Tools
MissingTypesValidator
You can use the built-in tool to search for lost types.
(this error occurs if the serialized data stores information about a type that no longer exists and could have been deleted during development). To start, you can run
Tools -> SREditor -> Check MissingTypes
> At least one SRMissingTypesValidatorConfig is required to work.
If necessary, you can implement your own IAssetMissingTypeReport for error
reporting if you use it in CI/CD systems.
You can also implement your own IAssetsLoader if the default LoadAllScriptableObjects is not suitable for you.
Class Replacer
A utility tool for replacing SerializeReference classes.
Access through Tools -> SREditor -> Class Replacer
FormerlySerializedType attribute
An analogue of FormerlySerializedAs attribute for SerializeReference classes, helping maintain serialization when class names change.
Example:
[Serializable, SRName("New Test")]
[FormerlySerializedType("SRDemo, Demo.OldTestData")]
public class NewTestData : BaseTestData
Duplicate Cleaner
Automatic detection and handling of SerializeReference object duplicates with configurable settings:
- Nullify duplicates
- Create defaults
- Make deep copies
This prevents issues with unwanted reference sharing in assets.
Support Unity 2021.3 or later.
Compatibility
| Unity version | Built-in | URP | HDRP | Custom |
|---|---|---|---|---|
| 2022.3.62f2 | Compatible | Compatible | Compatible | Compatible |
As listed on the Asset Store.