Hi! I have some logic that depend on the aspect ratio of a camera.
It seems that this data is not available until the first Update, that is, not even in Start(). Even waiting for a second doesn’t change the result. I expect that Start is run during compilation. Is it?
When I moved the setup logic into Update, I started getting the data I needed.
I don’t know how to get the correct aspect when running in the editor either, which makes things a lot harder. All I get is the aspect of the scene view.
Compilation is when you, uhm, “compile” your project, and no methods are called. Then, when you start playing, the sequence is: Awake (once) > Start (once) > Update (repeated every frame), as Jake-GR said.
Getting the aspect ratio of a camera in the Editor is hell, especially if you’re using Screen.width/height, because while it’s not playing, Unity will return the width/height of the focused panel, instead than of the camera screen. A workaround I found is having the function that gets the size inside a MonoBehaviour attached to the camera: calling it from a Window/Inspector did the trick. Though, there was something else I had to do to make it work, but I can’t remember exactly what - you will need to investigate a little