Serializable Interfaces in Unity give you the ability to drag, drop, and serialize objects that implement a specific interface in Inspector fields, enabling powerful, type-safe assignments. Using a custom attribute, you can restrict assignments to components implementing a particular interface. Or use an open generic type that supports serialization of references, enforcing both base types and interface types. This setup leverages custom editor tooling and reflection for seamless Inspector integration, enhanced validation, and intuitive drag-and-drop functionality.
Want to support me? 😀
Buy me a coffee! https://ko-fi.com/adammyhre
🔔 Subscribe for more Unity Tutorials https://youtube.com/@git-amend
Discord: https://discord.gg/FDRZGQBBUC
#unity3d #gamedev #indiedev
▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
0:00 Require Interface Attribute and Interface Reference
6:38 Interface Reference Drawer
12:38 Adding Label Hints
16:12 Require Interface Drawer
*Source code:* https://github.com/adammyhre/Unity-Serialized-Interface
More Useful Code:
https://github.com/adammyhre?tab=repositories
Unity Utility Library: https://github.com/adammyhre/Unity-Utils
Lock Inspector Hotkey: https://gist.github.com/adammyhre/4754f731a93bf1cab0d1385ccfa23642
Assets Shown In This Video (Affiliate Links)
Odin - https://assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041?aid=1101lw3sv
Odin Validator - https://assetstore.unity.com/packages/tools/utilities/odin-validator-227861?aid=1101lw3sv
Hot Reload: https://assetstore.unity.com/packages/tools/utilities/hot-reload-edit-code-without-compiling-254358?aid=1101lw3sv
Hierarchy Icons: https://assetstore.unity.com/packages/tools/utilities/better-hierarchy-272963?aid=1101lw3sv
Better Transform: https://assetstore.unity.com/packages/tools/utilities/better-transform-size-notes-global-local-workspace-child-parent--276554?aid=1101lw3sv
Better Mesh Filter: https://assetstore.unity.com/packages/tools/utilities/better-mesh-filter-266489?aid=1101lw3sv
Editor Console Pro: https://assetstore.unity.com/packages/tools/utilities/editor-console-pro-11889?aid=1101lw3sv
Any Object Finder: https://assetstore.unity.com/packages/tools/utilities/any-object-finder-286455?aid=1101lw3sv
*Follow me!*
https://linktr.ee/gitamend