Search Unity

100% GPU usage in editor + builds

Discussion in 'Editor & General Support' started by DvidD, Dec 16, 2019.

  1. DvidD

    DvidD

    Joined:
    Jun 2, 2014
    Posts:
    4
    Hi,

    I've been having this problem for the last day or two that my game is using nearly 100% of my GPU at all times, which is something it never did before. The fans on my GPU spin like crazy after a short while and the game is laggy from the start. In the build, it's even quite noticeable that it's skipping multiple frames every second.

    Two "solutions" that I could find on Google included;

    1. "Turn on V-Sync", which helps to reduce the GPU usage somewhat, but the lag still remains.

    2. "It's okay for a GPU to hit 100%", which is cool with me, except that it has never really gone above 75%-ish in the year that I've been working on it and it doesn't explain the very noticeable lag in the editor and in the builds of the game.

    If I revert back to a backup from not too long ago, there's no lag, nor will the GPU exceed any high percentages.
    The changes that I've made since the last stable version of the project have been rather minor, or at least in the sense that it's nothing that should have significant impact on performance. (Problem persists if I disable the changes)
    I also don't have any errors, warnings or prints in the console that are stacking up and the profiler is not showing anything out of the ordinary, so I'm confused as to why the GPU is struggling to keep up.

    I considered the fact that my GPU might be the problem, but I can run bigger games like GTA 5, DOOM and Forza Horizon 4 at (nearly) ultra settings with ease. No lag or high GPU usage, so I doubt it's my GPU.

    I would include some screenshots, but I wouldn't know of what, since there are no errors and the profiler is not showing anything strange. Only thing is that that the game lags because of a high GPU usage.

    Tl;dr:
    Recently, the editor and builds of my game started using 100% of my GPU at all times. No errors, no oddities in the profiler. It has never done this before and now the game lags for whatever reason.


    I'm using Unity 2018.3.8f1
    16GB DDR4
    GeForce GTX 970 4GB
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You say the profiler is not showing anything out of the ordinary, but the profiler should be showing what Unity is having the GPU working on regardless. I'd compare the profiler output between your current version and your last stable version to see what increased in usage.
     
  3. DvidD

    DvidD

    Joined:
    Jun 2, 2014
    Posts:
    4
    Thank you for you response, and I have checked the profiler again, but that's the strange part; Comparing this version with an older version doesn't show much of a difference, at least not bigger than a 5-10% increase at certain points. But Task Manager is still showing the GPU for Unity reaching those high numbers. Even if it's a different scene, the issue remains.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The profiler though should be at least showing you what it is working on, even if it is hard to tell what changed. Whatever Unity is spending so much time on, work on reducing that.
     
  5. Rockaso

    Rockaso

    Joined:
    Oct 31, 2016
    Posts:
    85
    Same issue, my project is 2D, big GPU usage, profiler doesnt show why.

    Any luck?
     
    blackbird and nofreewill42 like this.
  6. Camagine

    Camagine

    Joined:
    Sep 11, 2014
    Posts:
    6
    We are having the same issue. Basic graphics UI nothing moving and GPU 3D is running at 98%
     
    ElfMilad and CloudyVR like this.
  7. DryreL

    DryreL

    Joined:
    Feb 23, 2020
    Posts:
    49
    Same issue here. I have just 6 videos in the scene (1080p 60fps x264).

    And my GPU hits %100 while game runs. It's very strange! Scene is very small. Only videos, even I don't have rigidbody physics!! (GTX 1660 Ti)
     
    AbgaryanFX, CloudyVR and nofreewill42 like this.
  8. nofreewill42

    nofreewill42

    Joined:
    Feb 3, 2019
    Posts:
    5
    I have a 1080 Ti which I use for Deep Learning and want to try ML-Agents. I made a scene with two cubes and if I built the game and started the executable then my GPU usage went up to +98% and even my computer restarted sometimes, even though I don't even use my GPU for display but I have my monitors connected to my motherboard. And then I thought that it may be the case that Unity may assume that if there is a GPU then yeah, sure, there is the business to do. So I hooked my monitors to the GPU and GPU usage is down at 4%.
    Hope this helps others.

    Is there a way to tell Unity not to use the GPU for rendering? I want my GPU to only handle deep learning stuff so that while training I can do other stuff without facing laggy display.
     
  9. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    You can launch the Unity player with command line arguments to disable graphics output

    https://docs.unity3d.com/Manual/CommandLineArguments.html

    I would also suggest running some stress tests (prime95, furmark etc). Your computer should not be crashing under any workload, and it is a sign that something is wrong with it.
     
  10. Dead-Corn

    Dead-Corn

    Joined:
    Mar 12, 2021
    Posts:
    1
    Been trying to find the answer to this with my colleague for a week, they have the problem on their device but I dont on mine.

    On my device the game runs at 60fps. On his it runs at 2500fps. Not found the solution in the settings yet but the solutions is to force a frame limit so unity doesnt automatically set the graphics settings too damn high. Goodluck with your builds team!
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    VSync is likely force disabled in his GPU driver settings.
     
    CyberEVAlution and Joe-Censored like this.
  12. LightSolid

    LightSolid

    Joined:
    Feb 23, 2021
    Posts:
    2
    Had the same issue. I turned VSync on and reduced max frame rate to 120 in NVIDIA Control Panel. Down to 30% from 100%
     
    DevDunk, solkyoshiro, -chris and 2 others like this.
  13. zitonglove12

    zitonglove12

    Joined:
    Jan 4, 2017
    Posts:
    1
    Had the same issue.
    Empty Scene GPU usage 98%
    GPU:3070ti
    CPU:I7-12700H
    Unity:2021.3.11f1c2
     
  14. Puma3indiedev

    Puma3indiedev

    Joined:
    Aug 17, 2020
    Posts:
    1
    I figured out a possible solution, it might work for you. Disable vSync and then use this in one of your scripts.

    public void Awake()
    {
    Application.targetFrameRate = 45;
    }

    It will try to keep your FPS at around the target you set, so it will no longer be trying to run the game at 1000+ FPS
     
    Last edited: Mar 24, 2023
    Argos and xucian like this.