Derived Class in ComponentReference

GitHub - cyberaslan/Addressables-ComponentReference-with-DerivedClass: ComponentReference<T> capable to get derived class of component that inherits T.
Component derived class problem
Imagine you have some service creates Overlay from prefab list by generic type parameter.

Concrete overlay class inherits BaseOverlay but ComponentReference is always not ComponentReference cause generic-types specific.

Solution

  1. Realise IComponentReference interface in BaseClass
  2. Get derived ConcreteClass type attached to prefab by GetDerivedComponentType() method.