rabidus-test/Assets/CurvedUI/Demo Scenes/Demo Scenes Content/CUI_WorldSpaceCursorFollow.cs

25 lines
644 B
C#
Raw Permalink Normal View History

2023-08-15 17:38:54 +03:00
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_WorldSpaceCursorFollow : MonoBehaviour
{
CurvedUISettings mySettings;
// Use this for initialization
void Start()
{
mySettings = GetComponentInParent<CurvedUISettings>();
CurvedUIInputModule.Instance.WorldSpaceMouseInCanvasSpace -= (mySettings.transform as RectTransform).rect.size / 2.0f;
}
// Update is called once per frame
void Update()
{
transform.localPosition = CurvedUIInputModule.Instance.WorldSpaceMouseInCanvasSpace;
}
}
}