- Home /
Assets/Scripts/ThrowPad.cs(8,14): error CS0535: `ThrowPad' does not implement interface member `UnityEngine.EventSystems.IDragHandler.OnDrag(UnityEngine.EventSystems.PointerEventData)'
Hey guys,
I keep getting this error with my script, and I don't know what is wrong with it. :S Assets/Scripts/ThrowPad.cs(8,14): error CS0535: ThrowPad' does not implement interface member UnityEngine.EventSystems.IDragHandler.OnDrag(UnityEngine.EventSystems.PointerEventData)'
 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.EventSystems;
 using System.Collections;
 
 
 
 public class ThrowPad : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler {
 
     public float smoothing;
     public float distanceMin;
     public float zSpeed;
 
     private Vector2 origin;
     private Vector2 direction;
     private Vector2 smoothDirection;
     private bool touched;
     private int pointerID;
 
     private GameObject propje;
     private Rigidbody rb;
 
     private float startTime, diffTime;
 
     void Start() {
         propje = GameObject.Find ("papier prop");
         rb = propje.GetComponent<Rigidbody> ();
     }
 
     void Awake () {
         direction = Vector2.zero;
         touched = false;
     }
 
     public void OnPointerDown (PointerEventData data) {
         if (!touched) {
             touched = true;
             pointerID = data.pointerId;
             origin = data.position;
             startTime = Time.time;
         }
     }
 
     public void onDrag (PointerEventData data) {
         if (lengthReached(origin, data.position)) {
             diffTime = Time.time - startTime;
 
             direction = (origin - data.position).normalized;
 
             Vector3 dir = new Vector3 (direction.x, direction.y, zSpeed);
             rb.AddForce (dir * smoothing);
         }
     }
 
     public void OnPointerUp (PointerEventData data) {
         if (data.pointerId == pointerID) {
             direction = Vector2.zero;
             touched = false;
         }
     }
 
     public bool lengthReached(Vector2 origin, Vector2 dragged) {
         if (Vector2.Distance(origin, dragged) >= distanceMin) {
             return true;
         }
         return false;
     }
 }
any help would be really appreciated because I need to get this wroking soon.
Thanks,
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Hellium · Nov 20, 2016 at 08:09 PM
Because you have mispelled the function name :
   public void OnDrag (PointerEventData data) {
Your answer
 
 
             Follow this Question
Related Questions
BCE0019 when using functions 0 Answers
How to successfully apply force calling a function from another script 1 Answer
OnCollisionEnter problem 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                