Unable to implement IPointerClickHandler as it’s showing up as a class, but according to the documentation is should be an interface. Does anyone know what is going on here? Am I missing something obvious?
Are you sure you don’t have created your own class and named it “IPointerClickHandler”? Try right-clicking “IPointerClickHandler” and select “go to definition”. That should bring you to the place where this “class” is defined.
I don’t think IPointerClickHandler ever was a class since the EventSystem got introduced. It wouldn’t make any sense since the “I” at the start is a common convention for interfaces and according to the documentation it is an interface. So chances are high you have created (or imported from a third party) a class with the same name in the global namespace. The global namespace always takes precedence over other namespaces so it essentially hides Unity’s interface. You have two options:
- Remove / rename that conflicting class. Strongly recommended.
- Instead of using just “IPointerClickHandler” you can use the full classname including the namespace
As I said i strongly recommend to get rid of that wrongly named class. However if you want to keep it (for some reason) you can do this:
public class MyComponent : MonoBehaviour, UnityEngine.EventSystems.IPointerClickHandler
{
// [ ... ]
I would have used your actual class example but since you did not follow the guidelines of posting code as code and not as image i will not retype your class definition from an image ^^.