ScreenPointToLocalPointInRectangle

Hi, just wondering if this unit “ScreenPointToLocalPointInRectangle” is available in Visual Scripting. Or can it be made ?

I’ve had no luck finding it…

Add RectTransformUtility in Project Settings/Visual Scripting as a new type in the Node Library, then regenerate nodes. It should come up in search after that.

That worked, thanks.

What I’m trying to do is convert some script “Virtual Cursor” into Visual Scripting.

But being a Noob I’m not sure how to do it. Any help would be greatly appreciated…

public class FollowMouseForUI : MonoBehaviour
{
[SerializeField] Canvas myCanvas;
private Camera cam;
private Vector2 mousePosition;
private Vector2 pos;

private void Awake()
{
cam = Camera.main;
}

// Update is called once per frame
void Update()
{
Vector2 mousePos = Mouse.current.position.ReadValue();
RectTransformUtility.ScreenPointToLocalPointInRectangle(myCanvas.transform as RectTransform, mousePos, myCanvas.worldCamera, out pos);
transform.position = myCanvas.transform.TransformPoint(pos);
}
}