Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question Change graphics API at launch (if changed in-game then requiring restart) or at runtime

Discussion in 'General Graphics' started by Muke24, Aug 4, 2020.

  1. Muke24


    Nov 6, 2019
    So, I am currently developing a game that will use both the Universal Render Pipeline and the High Definition Render Pipeline where players may toggle to "Standard Graphics" or "HD Graphics". The main reason I am trying to implement this is for the game to support Raytracing, which means DirectX 12 is needed. I want to be able to let the players choice which version of directX they desire. I have read a possible way but I am not sure if it would work, and would like someone who has possibly done it to tell me how to get it working.

    The link above shows a way to force the API version at startup, so I was thinking if I could possibly change the batch file up a bit to work the way I'm intending. A way I was thinking is a drop down within the in game settings where the player may change to DirectX11 or DirectX12, and it would restart the game by storing which API was selected somewhere, closing the game and running the batch file which will read which API was selected then force it to run with that API.

    I do know some will say to just use DirectX 12, which I will do if there is no possible way to do this, but I wanted to see if this is possible.

    Would anyone know if this would work, and how I could do it as I am not experienced enough with batch.

    I'm using Unity 2020.1.

    Last edited: Aug 5, 2020
    AntonioModer likes this.
  2. akashdarshan99


    Feb 26, 2020
    Unity should provide an option to read the data from player prefs instead of expecting a launch argument.
    Launch argument is pretty stupid and prevents a direct way to take end user's input if they prefer DirectX12 or 11 or vulkan. The only feasible approach for achieving multiple graphics api switch is to use an external app to launch the game which seems really hacky