Hello, I’m having a problem converting the X coord of the Input.mousePosition with the ScreenToWorldPoint.
My grid is ok. It’s a 9x5 unit grid that is working fine placing the attackers and defenders by typing their position in the previous lessons and etc.
When I did the challenge of printing the World Unit coords of the OnMouseDown, I was getting the correct Y coord but a strange X coord. Trying to figure out why, I noticed that in the Game Tab, the height of the Camera was exactly the same of the Level Canvas, but the width was bigger. That was happening because I was setting the Game Tab with Free Aspect.
So, I changed the Game Tab to a 16:9 aspect ratio expecting to work. The camera was exactly like the Level Canvas now but I was still getting strange X coords. But now it was different coords from when Free Aspect was set.
Than, I removed the DefenderSpawner.cs from the Core Game, and with the Game Tab already set to 16:9, I added the script again. I don’t know why but this time it worked!!!
I changed the Game Tab to a 4:3 aspect ratio expecting to still work, but it didn’t work!
I came back to the video and noticed that Ben is still using a Free Aspect Ratio until this point of the section but he didn’t got this error.
Even though I’m getting correct coords now, I’m pretty sure something is wrong here, because it was supposed to work with a 4:3 screen and because the Free Aspect didn’t caused problems to Ben.
Thanks!!