In the Unity docs, this methods signature is: public Vector3 ScreenToWorldPoint (Vector3 position); Interesting thing with this, is I was able to use a Vector2 instead for the mouse input for x and y. During the challenge, I realized I had used a Vector2, but wanted to see the compiler errors so I can get accustomed to those as I figured it would help along the way with errors.
To my surprise, I didn’t get any errors! So I ended up with this code for the challenge. I just hope it won’t cause problems in the later sections of this project.
Vector2 WorldPointOfMouseClick() {
Vector2 point = cam.ScreenToWorldPoint(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
return point;
}
And yes, I was able to get world coordinates when I clicked on the game panel.