IPolymorphic.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
  2. using UnityEngine;
  3. namespace Animancer
  4. {
  5. /************************************************************************************************************************/
  6. /// <summary>
  7. /// An object that will be drawn by a <see cref="Editor.PolymorphicDrawer"/>
  8. /// which allows the user to select its type in the Inspector.
  9. /// </summary>
  10. /// <remarks>
  11. /// Implement this interface in a <see cref="UnityEditor.PropertyDrawer"/> to indicate that it
  12. /// should entirely replace the <see cref="Editor.PolymorphicDrawer"/>.
  13. /// </remarks>
  14. /// https://kybernetik.com.au/animancer/api/Animancer/IPolymorphic
  15. public interface IPolymorphic { }
  16. /************************************************************************************************************************/
  17. /// <summary>An <see cref="IPolymorphic"/> with a <see cref="Reset"/> method.</summary>
  18. /// https://kybernetik.com.au/animancer/api/Animancer/IPolymorphicReset
  19. public interface IPolymorphicReset : IPolymorphic
  20. {
  21. /// <summary>Called when an instance of this type is created in a [<see cref="SerializeReference"/>] field.</summary>
  22. void Reset(object oldValue = null);
  23. }
  24. /************************************************************************************************************************/
  25. /// <summary>
  26. /// The attributed field will be drawn by a <see cref="Editor.PolymorphicDrawer"/>
  27. /// which allows the user to select its type in the Inspector.
  28. /// </summary>
  29. /// https://kybernetik.com.au/animancer/api/Animancer/PolymorphicAttribute
  30. public sealed class PolymorphicAttribute : PropertyAttribute { }
  31. /************************************************************************************************************************/
  32. }