Selecting at runtime the graphics API

I know I can in the player settings control the graphics api to include. such as opengles2 and metal etc.

However for easy QA builds I want to be able to select or override metal builds with opengles2.0 or 3.0 versions using Settings.bundle root.plist then during launch automatically set the graphics api to use.

I’ve only been able to find in PlayerSettings scriptAPi any method of controlling the choosing of an api. I can of course use Systeminfo,graphicsDeviceType to print out the choice but I cannot quite figure out if its possible to change the API selection on launch.

-andi

2 Answers

2

I would love this also! I’m having serious troubles with my players because some features are not working in opengles 2 or 3, and vice-versa. It is hard keeping two versions of the game, I must create an option so the user may change it.

You're still using an arbitrary asset path regardless of whether it contains a Resources folder. Resources.Load can't use a path like that. It can load any object, but needs a valid Resources string. See the docs for Resources.Load for examples of valid strings you can use.

I would like to know this as well. Is there any method to set the GraphicsDeviceType on runtime?
Something like this?

private void SetGraphicsDevice()
{
    UnityEditor.PlayerSettings.SetGraphicsAPIs(UnityEditor.BuildTarget.iOS, 
    new[] { UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2 });
}

I see what you mean. Even fixing that line (using activeFile = (LipSync)Resources.Load("Resources/SaveData/LipSyncData/" + clip.name + " (LipSync)");) still throws the error.