Search code examples
user-interfaceunity-game-enginecamerapost-processingscalable

Unity3d: Camera Effects look different in different screen sizes


I have applied some post processing effects to my camera. They looked fine in the free aspect minimized game view but when I maximize it or change the aspect ratio the effects look different. And also how can I make my UI elements change as the screen size changes.

Images:

enter image description here

enter image description here


Solution

  • This is a bug in post processing stack and is still not fixed by them. But I found a fix here.

    Fix:

    open the DepthOfFieldComponent.cs, remove const from before k_FilmHeight, then have it update somewhere such as in Prepare, above CalculateFocalLength, add something like: k_FilmHeight = 0.024f * (Screen.height / 720.0f);

    720 can be changed to whatever number you want to use as your default screen height.