Search Unity

Question Change saved texture assets' compression type per platform

Discussion in 'Editor & General Support' started by joshuacwilde, Jan 23, 2021.

  1. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    726
    I am programmatically creating and saving texture assets (Texture2DArray and Texture2D). They are created in editor of course, but used for mobile. The problem is that in editor they are created as DXT type textures. And of course this doesn't work on iOS. I added some code to compress to PVRTC when switched to iOS platform, but now they won't show in the editor because PVRTC is not supported in the editor.

    How can I have programmatically created texture assets work in both the editor and iOS? Using uncompressed textures is not an option.
     
    Last edited: Jan 23, 2021
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,686
    Perhaps a custom build step that checks if it is in iOS and reimports those textures in the new format? Then revert them afterwards...
     
  3. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    726
    Yeah I was thinking about that, but it seems very odd for something that unity should already have built in. Plus it's hard to test as I gotta wait for the project to compile. Which takes a long time.