ZLinq
ZLinq copied to clipboard
OfComponent() generic Component constraint
Hi,
OfComponent<T> extension has a constraint that T is a Component. That used to be a requirement for a call to GetComponent<T>() but that is no longer the case. It is problematic as it does not allow to GetComponent() by its interface say we have:
class MyCompoenent : MonoBehaviour, IInteractable
{
}
it is valid to do gameObject.GetCompoenent<IInteractable>() but currently not possible to do gameObjects.OfComonent<IInteractable>();