JUtils
A unity utilities library
JUtils.TypeSelectorAttribute Class Reference

Show a dropdown for all classes that extend the field's type. Requires SerializeReference attribute to function correctly More...

Inheritance diagram for JUtils.TypeSelectorAttribute:
Collaboration diagram for JUtils.TypeSelectorAttribute:

Detailed Description

Show a dropdown for all classes that extend the field's type. Requires SerializeReference attribute to function correctly

namespace Example
{
public class TypeSelectorTest : MonoBehaviour
{
[SerializeReference, TypeSelector] public IAnimal _animal;
}
public interface IAnimal {
string name { get; }
}
public class Dog : IAnimal
{
[field: SerializeField]
public string name { get; set; }
[field: SerializeField]
public string bark { get; set; }
}
public class Cat : IAnimal
{
[field: SerializeField]
public string name { get; set; }
[field: SerializeField]
public string meow { get; set; }
}
}

The documentation for this class was generated from the following file: