I’m having some issues with my OnPointerClickString Class. When I tried to implement IPointerClickHandler and ISubmitHandler I got two errors saying OnPointerClickString does not implement them. Any ideas why? am I missing a library I need to implement? Did I implement them incorrectly?
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using System.Collections;
public class OnPointerClickString : MonoBehaviour, IPointerClickHandler, ISubmitHandler {
void OnPointerClick(PointerEventData eventData){
Debug.Log("Has Clicked");
}
}
An interface only contains signatures - so no actual implementation code. If you are creating a class that implements an interface (in your case, your class implements 2 interfaces), you must implement every member in the specified interface(s) within your class.
I don’t know what IDE you’re using, but Visual Studio has the ability to automatically generate stubs for specified interfaces. That said, you still have to provide the implementation code.
you basically have to write each method down before the error will go away so you still need to add
void OnPointerClick(PointerEventData click){
Debug.Log("Has Clicked");
}
void OnSubmit(BaseEventData submit){
Debug.Log("Has Submit");
}