Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Texture Importer not work?

Discussion in 'Editor & General Support' started by duotemplar, Feb 10, 2015.

  1. duotemplar

    duotemplar

    Joined:
    Dec 30, 2010
    Posts:
    26
    hi everyone!

    I need batch to change my texture import setting about hundred files.So I write a edtior script.But the code weird.It work fine, but sometimes, there are serverl texture not change the setting.And on my PC, it can change all the texture setting correct, and on my Mac, or other people, some texture changes, and some not.

    I searched this forums and find some people alose have this problem, but none of solution.Can somebody explain this, or disscuss together?

    This is my code:

    TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(s);
    importer.textureType = TextureImporterType.Advanced;
    importer.textureFormat = importFormat;
    importer.npotScale = TextureImporterNPOTScale.ToNearest;
    importer.mipmapEnabled = false;
    importer.maxTextureSize = 4096;
    importer.anisoLevel = 0;

    AssetDatabase.ImportAsset(s);
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    If the textures are all in the same folder you should be able to multi-select them all, and then use the inspector to make a change to all of them. (At least, that is what I do, but then I don't typically have so many textures.)
     
  3. duotemplar

    duotemplar

    Joined:
    Dec 30, 2010
    Posts:
    26
    OK, I found what happen: the files which not work because we name the "*.png" to "*.PNG".Unity also can recognize the texture asset,but when we use i/o api to read the files, these file missed to be found.

    So, unity api works fine.

    Thanks!
     
    Graham-Dunnett likes this.
  4. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Im trying to do this but cant see not change max size, i use texImporter.maxTextureSize = 4096; but it doesnt actually seem to do anything, any ideas?