Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Opening UnityHub with prime-run nvidia GPU

Discussion in 'Linux' started by positive-season, Feb 22, 2023.

  1. positive-season

    positive-season

    Joined:
    Oct 17, 2021
    Posts:
    1
    Hey Linux Users!

    Hopefully an easy solution (fingers crossed).

    I've recently installed KDE Neon 5.26 (upgraded to 5.27 though happened before the upgrade too), installed UnityHub via: (Debian / Ubuntu): https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux and then created my own .desktop file which runs Exec=prime-run unityhub
    (prime-run is a way to specifically open a program using the Nvidia GPU, contents of prime-run is:
    #!/bin/bash
    export __NV_PRIME_RENDER_OFFLOAD=1
    export __GLX_VENDOR_LIBRARY_NAME=nvidia
    export __VK_LAYER_NV_optimus=NVIDIA_only
    export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
    exec "$@"
    )

    I can see that my Nvidia GPU is being utilised through nvtop which shows a graphical graph of the utilisation going up (plus using nvidia-settings, same thing)

    This all works correctly and opens Unity Hub (3.4.1), then I can use the Unity Editor (2021.3.18f1 : OpenGL). However the bug that I've seen is:
    If I click on items within the Hierarchy view, after 2-3 clicks, the Inspector (right hand side) seems to lag behind one item. So as an example:
    I click item1, it displays item1 in Inspector,
    I click item2, it displays item2 in Inspector,
    I click item3, it still displays item2 in the Inspector,
    I click item4, it displays item3 in the Inspector,
    I click item5, it displays item4 in the Inspector.

    [edit: this isn't just limited to the whole Inspector refresh, I've also noticed with variable changes within a [SerializeField], but because of this, I can't tell you 100% if it's the game tab that doesn't update properly (say if I edited the speed of an object), or if the Inspector didn't update it from a GUI point of view, an example of this if I change the speed from 20 => 200, the speed doesn't seem to update within the Game tab, until I change the variable again 200 => 2000, then it changes the speed to 200, but if I change the speed again 2000 => 20, the Game tab looks like the object is moving at 2000.]

    Once in a while it will catch up with itself, but most of the time, this happens frequently, and I've been unable to figure out why.

    However I have managed to pin point it it's either to do with prime-run or the Nvidia GPU (Driver 525 - has also been tested and same scenario on Nvidia 515) because when I run Unity Hub without prime-run, it's fine.
    However then I won't be utilising the Nvidia GPU if I need it (luckily in this scenario, I'm not that fussed because the game I'm creating is lightweight, but I'm concerned about when I create bigger projects such as an MMORPG (which is on my TODO to carry on :-D )).

    This isn't a high priority, and it may be that I'm doing something wrong and causing this bug myself, if that's the case, please don't hesitate to let me know, it's all a learning experience!

    P.S I'm using X11 X.Org version: 1.21.1.3

    Thanks for reading!