Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity The Future of Unity Feedback

Discussion in 'Announcements' started by Buhlaine, Feb 21, 2019.

Thread Status:
Not open for further replies.
  1. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    692
    My game is perfectly stable at 60fps the jittering exists only when I use the Application.targetFrameRate to lower the FPS even from 60 to 59 or any other value different than 60. But some times the same device is set to 30fps by default and the game is smooth until I touch the Application.targetFrameRate. I think unity is not correctly sleeping between Frames when someone tries to limit the FrameRate.
    I don't see any other reason, if it was some resources problem then why it's running perfectly smooth at start and stay at a stable 60FPS with very low variance between Frames for at least 30mn and then goes crazy only when I set the FrameRate.
     
  2. BradZoob

    BradZoob

    Joined:
    Feb 12, 2014
    Posts:
    44
    agh goddamn it another wrecked unity solution redirected to this forum. lol you freakin' noobs. :p
     
    Storm4_ and Casper-Chimp like this.
  3. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    3,784
    Sorry that I jump into the conversation; why do you want to force the fps to 30 if your game is stable otherwise? Could you provide the code you are using?
     
  4. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    692
    Because it’s not a good idea to let the game fix at 60fps for everyone, it’s a mobile game and the battery consumption is a very important factor so as unity said in their docs, the best approach is to make it stable at 60fps and run it at 30fps. This is what we did, but 1) sometime it runs at 60fps by default and changing it to 30fps using the Application.targetFrameRate creates the jitter . 2) the most of time it runs at 30fps by default without jitter but What if it’s a high end device and the player wants a perfect and smooth game running at 60fps changing it makes it run smooth but after maybe 30mn of game the phone’s CPU will starts overheating and the game will not be stable at 60fps all the time, then even if it’s 59fps the jitter is noticeable ( when the game is started at 60fps by default the jitter is not noticeable even when a low end device is not able to maintain it like between 40~60 its perfectly smooth) and all these problems are not existing in the editor.
    I think it’s a low level problem and it’s really disappointing to see it existing in Unity 2019.3, maintaining a controlled stable FPS should be already done years ago. I know it’s impossible to to maintain an FPS if my code is not able to reach that frame, but I’m doing the opposite Im dropping the FPS from stable and smooth 60fps to unstable <=59fps with crazy deltaTimes, this how looks like Time.deltaTime at 40fps (0.03308875, 0.00001, 0.03309203, 0.03311411, 0.02692817, 0.006139117, 0.03307073, .......) on device instead of a stable 0.025s
     
  5. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    3,784
    You need to create your own thread and post the code you are using.

    Did you try using if statements setting the fps target according to the device in use?
    Code (CSharp):
    1.         if(Application.isMobilePlatform)
    2.             Application.targetFrameRate = 30;
     
    Last edited: Jan 4, 2020
  6. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    692
    How can I set the FPS without using the Application.targetFrameRate ? It creates too much variance between frames. The vSync is not good for all devices.
    I already created a thread here but posting the problem here as a feedback and looking for more advices.
     
  7. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    3,784
    I just edited my post above.
     
  8. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    692
    This line Application.targetFrameRate = 30; makes my frame rate unstable
     
  9. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    692
    Can you please try to create an empty Android project set target frame rate to 40 and debug the Time.deltaTime to see the variance between them ?
     
  10. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    3,784
    Frame rate is a float, it's not meant to be stable; you'll always get an average value around the value you set.
     
  11. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    3,784
    Sorry, cannot do that. :)

    Anyway, cell phones will never get you steady fps, especially if you have lights, shadows, particle effects and so on. You'd need to strip your game of most of them.
     
    Opeth001 likes this.
  12. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    692
    We are talking about the same stability, it’s not about ~0.005 which is already high, but a stable variance of 0.016 every second
     
  13. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Setting vsync to 2 = 30hz
     
  14. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,358
    @Opeth001 there is no way to guarantee fixed 100% stable frame rate, specially when other processes running in background.

    But to be honest, as been already appointed, at this point you hijack the thread, with a problem which is related to lack of understanding technical aspects, rather than any bug or feedback related subject to this thread.
     
    hippocoder likes this.
  15. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Guys can you take it off-thread (make a new thread for all your individual issues). This thread is so random at this point that it's gibberish that I'm having to lock because the value died a long time ago for the OP and posters.

    Will's not getting future of unity feedback and the users are posting stuff that's so random the right eyes will never guess that the future of unity involves looking at frame timings.
     
Thread Status:
Not open for further replies.
unityunity