How can I go about implementing an interface AND inheriting MonoBehaviour for a class? An interface cannot inherit monobehaviour and I can’t have multiple inheritance so how can this be solved?
The MonoBehaviour inheritance cannot be part of an interface, but the classes that implement that interface can inherit Monobehaviour. You can have one Superclass, and implement an infinite number of Interfaces.
Something like this:
public class MyClass : MonoBehaviour, IPointerEnterHandler {
public void OnPointerEnter(PointerEventData eventData) {
}
}
One thing to note: The inheritance has to always be the first element, followed by all the interfaces you want to implement.