NewN_UAVPlane/Assets/Zion/Scripts/Adam/Components/RawImageMoveAttach.cs

28 lines
678 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class RawImageMoveAttach : MonoBehaviour, IBeginDragHandler,IDragHandler
{
public UnityAction<float> onMoveX;
public UnityAction<float> onMoveY;
public void OnBeginDrag(PointerEventData eventData)
{
}
public void OnDrag(PointerEventData eventData)
{
Vector3 mousePosition = Input.mousePosition;
Vector2 pos2 = Camera.main.WorldToViewportPoint(eventData.position);
onMoveX.Invoke(eventData.position.x);
onMoveY.Invoke(eventData.position.y);
}
}