Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

max texture size at run-time?

Discussion in 'Android' started by akasurreal, Dec 13, 2012.

  1. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    Is there a way to query the device's max texture size at run-time from Unity?

    I want to use 4096 textures and switch to "half-res" quality setting on devices that don't support it, but I don't see a way to determine that.

    I found this for native code:
    Code (csharp):
    1. int[] max = new int[1];
    2. gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, max, 0); //put the maximum texture size in the array.
    But hoping there is some way through Unity to access this information. Thanks!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Unity reduces texture resolution automatically when necessary as far as I know.

    --Eric
     
  3. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    In my testing, it did not. I tried to run it on a tablet that did not support 4096 and I get black boxes. When I switch to half-res manually, it works fine though. I did the same test on iOS with same results. iOS is much easier test though because any screen over 1024 width supports 4096. Using 3.5.6f4
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, maybe that only worked on the desktop then.

    --Eric
     
  5. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    So any solutions out there?