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

21 lines
516 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;
}
public void OnDrag(PointerEventData eventData)
{
transform.position = eventData.position;
}
public void OnEndDrag(PointerEventData eventData)
{
transform.position = StarTransform;
}
}