Search Unity

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

    Administrator

    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,633
    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?