Normally, serialised polymorphic references are only possible through class inheritance. This snippet provides a means by which you can drag and drop persistent, serialisable references to interfaces on other Monobehaviours and GameObjects. Simply add the following code to your project:
Useful (?) snippet: serializable interface references
Code (CSharp):
- [System.Serializable]
- public class IRef<T> : ISerializationCallbackReceiver where T : class
- {
- public UnityEngine.Object target;
- public T I { get => target as T; }
- public static...