This repository provides editor tooling for Unity's [SerializeReference], including SubclassSelector
to pick concrete implementations of interfaces / abstract types in the Inspector.
Primary risk area: type discovery & filtering (what types appear in the selector).
- Repository URL:
https://github.com/mackysoft/Unity-SerializeReferenceExtensions - Package source:
Assets/MackySoft/MackySoft.SerializeReferenceExtensions - Editor code:
.../Editor/** - Tests:
.../Tests/**
- Minimum supported Unity: 2021.3 (baseline for development/testing).
- Unity 2023.2+ has enhanced generic type support (variance, etc.). Changes must not break 2021.3 behavior and guarded by
UNITY_2023_2_OR_NEWER.
I use GameCI unity-test-runner.
- Always run EditMode tests.
- Run a Unity matrix that includes:
- 2021.3.x (minimum baseline)
- 2023.2+ (generic/variance feature gate)
Run Unity in batchmode:
PROJECT_ROOT="$(pwd)"
RESULT_XML="$PROJECT_ROOT/TestResults/editmode.xml"
mkdir -p "$(dirname "$RESULT_XML")"
"<UNITY_EXE>" -batchmode -nographics -quit \
-projectPath "$PROJECT_ROOT" \
-runTests -testPlatform editmode \
-testResults "$RESULT_XML"
- Runtime surface area should remain minimal (mainly attributes / data structures).
- Editor implementation (PropertyDrawer/UI/type search) must stay under
Editor/. - Avoid introducing UnityEditor references into Runtime assemblies.
- Prefer
UnityEditor.TypeCachefor type discovery. Avoid full AppDomain scans unless necessary. - Keep allocations low in IMGUI paths (e.g.,
OnGUI). - Keep public API stable; if changing type filtering behavior, add/adjust tests.
- As a general rule, you should follow the restrictions on SerializeReference in Unity's official documentation.