You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thanks for the great package, it works like a charm!
So I'm not sure if this is possible, but it would be nice if we could use SubclassSelector on abstract classes with a generic type. This way we could add an interface to the abstract class that does not have a generic type. Then we could use this to specify config values in a dictionary without a type.
My workaround for this is to use a generic interface and have a second plain interface just for selecting targets easily in configs.
publicclassExample:MonoBehaviour{[SerializeReference,SubclassSelector]privateTarget<Character>_target;// does NOT show ConcreteTarget[SerializeReference,SubclassSelector]privateITarget<Character>_target2;// DOES show ConcreteTarget// [SerializeReference, SubclassSelector]// private SerializedDictionary<ITarget, float> _configs;// not possible as the interface needs a generic type[SerializeReference,SubclassSelector]privateSerializedDictionary<ITargetConfigurable,float>_configs2;// possible workaround}// ideally we could add the generic type in the abstract class insteadpublicinterfaceITarget<T>{TGetTargets();}// using an extra interface instead of ITarget allows us to select a target without type eg. in a configpublicinterfaceITargetConfigurable{}publicabstractclassTarget<T>:ITarget<T>,ITargetConfigurable{publicabstractTGetTargets();}[Serializable]publicclassConcreteTarget:Target<Character>{publicoverrideCharacterGetTargets()=>null;}publicclassCharacter{}
The text was updated successfully, but these errors were encountered:
Feature description
First of all thanks for the great package, it works like a charm!
So I'm not sure if this is possible, but it would be nice if we could use
SubclassSelector
on abstract classes with a generic type. This way we could add an interface to the abstract class that does not have a generic type. Then we could use this to specify config values in a dictionary without a type.My workaround for this is to use a generic interface and have a second plain interface just for selecting targets easily in configs.
The text was updated successfully, but these errors were encountered: