Deaing with screen width

First off, great course! Really enjoying it. This is my first post (beyond introducing myself)

I don’t love having to expose screen width, and having to manually convert from 6 to 16 (6 * 2 * aspect ratio). With a little poking around, I came up with this:

width = camera.aspect * camera.orthographicSize * 2;

No more manually worrying about updating screen width units if aspect ratio changes!

Update: Even better, just use Camera.ScreenToWorldPoint! Did this method not exist when the course was created?

Privacy & Terms