screenToWorld method

Vector2 screenToWorld(
  1. Vector2 position
)

Takes a point in screen coordinates and returns it in world coordinates.

Remember that if you are using this for your events you can most of the time just use event.localPosition directly instead.

Implementation

Vector2 screenToWorld(Vector2 position) {
  return camera.globalToLocal(position);
}