Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Switching cameras first time = increase fps

Discussion in 'Editor & General Support' started by Rickyl, Feb 4, 2019.

  1. Rickyl

    Rickyl

    Joined:
    Dec 17, 2014
    Posts:
    6
    Hey all,

    The problem with my current game is the following.
    I have 2 camera's which i switch between, on my first gen iPad-pro and on my
    OnePlus 5T i have an increase in FPS when i go from the first camera to the second.

    Now u would think that going back to the first camera would decrease the FPS but
    it doesn't. On my iPad i have 18-24 fps and when switching, it jumps after a second to 30 and feels
    like it can do a 100 (moving through the entire level very fast and it keeps stable at the 30, capped by iPad).

    Switching scenes, i have the same problem again. As soon as it's loaded i switch the camera and go back to the first camera just to have the better FPS.

    The 2 camera's almost have the same stats and the scripts on it aren't the problem i would say. Does anyone know what could cause this and how i could solve it, so i have the good fps from the start.

    Screenshot 2019-02-04 at 16.39.05.png Screenshot 2019-02-04 at 16.39.13.png

    Best regards,
    RL
     
    Last edited: Feb 4, 2019
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    One of your cameras has a slightly larger FoV, so it may be rendering just a few more objects. The same camera seems to have a post-processing script attached, which is likely to be causing it to do extra rendering work to apply special effects once the scene has already been rendered. Just as a test, try disabling that script and see if the issue goes away.

    If none of that works, use the profiler to profile your GPU. You can see how long each object takes to render, and you can group them to see how long each group of objects takes to render. Watch the "Time MS" of each object, and notice which objects or groups render slower when one camera is active vs. another.

    Good luck!
     
    Rickyl likes this.
  3. Rickyl

    Rickyl

    Joined:
    Dec 17, 2014
    Posts:
    6

    Hey Gambit,

    So i tested the PP script and it is the culprit, i should have tested this earlier but i never taught it would be something from Unity :p

    Both camera's PP off -> perfect and same FPS.
    Both camera's PP on -> first camera has bad fps -> switch camera -> second camera has the good fps -> switch again to the first camera and suddenly that camera also has the good fps. (fps is obviously a bit less then when PP is off but stable and higher then when started)

    Camera one has no PP but camera 2 does -> still start with a lesser FPS -> switch -> camera 2 has around 8 more fps average than camera one -> switch back to camera one and now this camera has more fps than the second and around 22 more than when we started.

    I can wait ages before switching camera's, the fps will still be low until i switch cameras.
    But i can switch in the first second i'm in the scene and the fps goes up.

    I know i'm using the older version of PP, maybe i should upgrade to the newer one.
    The only thing i'm using is ambient occlusion on it. Gonna check it out. Or maybe i'll just forget about PP since it's for mobile and it's very very subtle on my game.
     
    Last edited: Feb 4, 2019