|
| 1 | +# Unity-SerializeReferenceExtensions — AGENTS.md |
| 2 | + |
| 3 | +## Project overview |
| 4 | +This repository provides editor tooling for Unity's [SerializeReference], including `SubclassSelector` |
| 5 | +to pick concrete implementations of interfaces / abstract types in the Inspector. |
| 6 | + |
| 7 | +Primary risk area: type discovery & filtering (what types appear in the selector). |
| 8 | + |
| 9 | +## Repository layout |
| 10 | +- Repository URL: `https://github.com/mackysoft/Unity-SerializeReferenceExtensions` |
| 11 | +- Package source: `Assets/MackySoft/MackySoft.SerializeReferenceExtensions` |
| 12 | +- Editor code: `.../Editor/**` |
| 13 | +- Tests: `.../Tests/**` |
| 14 | + |
| 15 | +## Unity compatibility (critical) |
| 16 | +- Minimum supported Unity: 2021.3 (baseline for development/testing). |
| 17 | +- 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`. |
| 18 | + |
| 19 | +## CI (GitHub Actions) |
| 20 | +I use GameCI `unity-test-runner`. |
| 21 | +- Always run EditMode tests. |
| 22 | +- Run a Unity matrix that includes: |
| 23 | + - 2021.3.x (minimum baseline) |
| 24 | + - 2023.2+ (generic/variance feature gate) |
| 25 | + |
| 26 | +## Architecture guardrails |
| 27 | +- Runtime surface area should remain minimal (mainly attributes / data structures). |
| 28 | +- Editor implementation (PropertyDrawer/UI/type search) must stay under `Editor/`. |
| 29 | +- Avoid introducing UnityEditor references into Runtime assemblies. |
| 30 | + |
| 31 | +## Coding conventions |
| 32 | +- Prefer `UnityEditor.TypeCache` for type discovery. Avoid full AppDomain scans unless necessary. |
| 33 | +- Keep allocations low in IMGUI paths (e.g., `OnGUI`). |
| 34 | +- Keep public API stable; if changing type filtering behavior, add/adjust tests. |
| 35 | +- As a general rule, you should follow the restrictions on SerializeReference in Unity's official documentation. |
| 36 | + - https://docs.unity3d.com/ScriptReference/SerializeReference.html |
0 commit comments