Skip to content

Instantly share code, notes, and snippets.

@brunomikoski
Created January 13, 2018 00:53
Show Gist options
  • Save brunomikoski/89385f8e4debf77a46f76729be7f1004 to your computer and use it in GitHub Desktop.
Save brunomikoski/89385f8e4debf77a46f76729be7f1004 to your computer and use it in GitHub Desktop.
Vector2 movePos;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(
targetCanvas.transform as RectTransform,
Input.mousePosition, camera,
out movePos))
{
Vector3 mousePos = targetCanvas.transform.TransformPoint(movePos);
cursorRectTransform.position = mousePos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment