I’ve been trying to get this working for over an hour now :(.
I have a file called InputManager. It’s attached to a rect transform that’s part of my ui canvas. Neither of the print functions are being called.
using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
public class InputManager : MonoBehaviour, IPointerDownHandler, IBeginDragHandler, IDragHandler, IEndDragHandler
{
public PlayerManager playerManager; //A link to the Player Manager
public void OnPointerDown(PointerEventData eventData){
print ("HELLOOOO??");
setPosition (); // is this necessary?
}
public void OnBeginDrag(PointerEventData eventData)
{
//playerManager.UpdateInput(true);
}
public void OnDrag(PointerEventData data)
{
print ("Anyone out there?");
setPosition ();
}
private void setPosition()
{
Vector2 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
playerManager.setPlayerPositionTo(pos);
}
public void OnEndDrag(PointerEventData eventData)
{
}
}