# How to temporarily set additional system environment variable only in 'play' mode inside godot editor?

I'm learning godot with a laptop that has AMD discrete GPU. My OS is Arch Linux so if I want to use discrete GPU I have to set system environment variable DRI_PRIME=1 temporarily. This can be easily done with pygame, just add following code:

import os

os.environ['DRI_PRIME'] = '1'


The game will launch using discrete GPU.

But if I want to do that in godot, I have to run it fully in discrete GPU, which means I have to use command DRI_PRIME=1 godot to launch it. It's now using discrete GPU to run game, but it takes 4-5 seconds to react to my input when I switch back from tutorial webpage from browser. That's because the discrete GPU will hang when switching out of godot, and I have to wait for it to respond. It will waste a lot of time if I frequently switch between godot and browser.

Is there any configuration to temporarily set system environment variable only in 'play' mode inside godot editor?

## 1 Answer

Seems the solution that works so far is to write my own shell script.

Here's the script:

#!/bin/sh

export DRI_PRIME=1

if [[ $# -ge 1 ]]; then if [[ -f 'Scenes/'$1'.tscn' ]]; then
godot -d Scenes/\$1.tscn --position 400,300;
else
echo 'File doesn'\''t exist!';
fi;
else
echo 'Please specify main scene!';
fi


I wish godot team to provide cmdline feature inside editor ( / __ \ )

• Sounds like you stumbled into something Godot does not have, but you wish it had. Consider writing a proposal: github.com/godotengine/godot-proposals Sep 5 at 22:30