NVIDIA Optimus in play mode

I was wondering if there would be a way to only make NVIDIA Optimus enable my laptop’s dedicated GPU when I am in play mode in unity.

The reason I ask this is because I can always run unity with the dedicated gpu, but it’s a waste of battery power if I am just working on scripts and such. Everything in Unity works perfectly smooth on the integrated gpu except when I enter play mode, and the integrated gpu isn’t very powerful and results in a low framerate.

not sure about doing it only at playtime but would you mind telling me what settings you used to get Unity to use the dedicated graphics card when on battery?

In the nvidia control panel I can’t seem to make changes that will actually keep unity running off the dedicated card. It still seems to be using the integrated when on battery no matter what.

Changing the preferred graphics card for the program and the power management mode to ‘prefer maximum’ performance’ doesn’t seem to actually work when unity is launched