Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by asmithers · Jul 04, 2016 at 12:58 PM · renderingiphonegraphicsipad

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

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image asmithers · Jul 05, 2016 at 10:28 PM 0
Share

I'm answering my own question. Not sure if this is the best way to do it..

I've modified the UnityAppSupport+rendering.mm file that was generated by the build. I've effectively modified the SelectRenderingAPIImpl function with a couple of lines of code that reads from standarduserdefaults a multi-value that is mapped from 0 to 2. This effectively swaps out values in the array if all 3 are added. So if gles2 is selected it will move that from the array tail. Now this only works if adding all rendering api's to the list for iOS.

 // reprioritize array by swapping index 0 for the specified
 NSInteger item = [[NSUserDefaults standardUserDefaults] integerFor$$anonymous$$ey:@"gfxapiSetting"];
 int temp = apis[0]; apis[0]  = apis[item]; apis[item] = temp;

the code is injected just before the for/loop iteration checking for the version to use. I dont need to check item existing because it defaults to 0 therefore it replaces itself. Auto is also set to 0 and is the default, metal is 0 ,gles3 is 1 and gles2 is 2.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Marcos-Elias · Jul 26, 2017 at 03:37 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by M_PLY · Feb 01, 2018 at 04:22 PM

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 });
 }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Weird iPad render bug 0 Answers

Possible to render a simple colored spot rather than use a PNG? 0 Answers

Specifying a high quality background image for iPad 1 Answer

SpriteManager2 and Universal Apps 1 Answer

About iPhone/iPad development 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges