_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/snailFactory/PointFollow.cs
2024-12-09 15:33:32 +08:00

22 lines
544 B
C#

using UnityEngine;
using UnityEngine.EventSystems;
public class PointFollow : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
public Vector3 StarTransform;
public void OnBeginDrag(PointerEventData eventData)
{
StarTransform = transform.position;
Debug.Log(1111111);
}
public void OnDrag(PointerEventData eventData)
{
transform.position = eventData.position;
}
public void OnEndDrag(PointerEventData eventData)
{
transform.position = StarTransform;
}
}