- Home /
OnDrag OnPointerDown OnPointerUp does not work
Hey guys, its my first time here. I read all questions and solutions. Didn't find my solution. So what did i do:
Adding EventSystem
Physics 2D Raycaster attached to camera
I have 2d Collider and raycast target on
I dont know what do i need to do. Could you please help me. I want to do this for an android joystick. If you have another solution, i would be grateful. Thx ^^ Here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class deneme : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler
{
public void OnDrag(PointerEventData eventData)
{
Debug.Log("Ondrag");
}
public void OnPointerDown(PointerEventData eventData)
{
Debug.Log("OnpDown");
}
public void OnPointerUp(PointerEventData eventData)
{
Debug.Log("OnpUp");
}
}
eventsystem.jpg
(86.3 kB)
camera.jpg
(237.5 kB)
Comment
Best Answer
Answer by yogummben · Apr 30, 2020 at 03:16 PM
Hey guys. I solved the problem. My console is just shows the error's . So it's all my foolishness. I thought my code is not working because i won't see on the console. If you don't get what i said you can check the image
console.png
(7.4 kB)