duck

duck

Nov 22nd, 2010
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1.  
  2.  
  3.  
  4. using UnityEngine;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using UnityEditor;
  8.  
  9. public class MyModelPostprocessor : AssetPostprocessor
  10. {
  11.  
  12.     void OnPostprocessAudio(AudioClip obj)
  13.     {
  14.         string path = AssetDatabase.GetAssetPath(obj);
  15.         Debug.Log("processing: " + path);
  16.         AudioImporter audioImporter = (AudioImporter)AssetImporter.GetAtPath(path);
  17.         audioImporter.format = AudioImporterFormat.OggVorbis;
  18.         audioImporter.channels = AudioImporterChannels.Mono;
  19.         audioImporter.compressionBitrate = 128000;
  20.         audioImporter.decompressOnLoad = true;
  21.         Debug.Log("Applied audio settings to: " + path);
  22.     }
  23.  
  24.     void OnPostprocessTexture(Texture2D obj)
  25.     {
  26.         string path = AssetDatabase.GetAssetPath(obj);
  27.  
  28.         TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(path);
  29.         textureImporter.textureFormat = TextureImporterFormat.Automatic;
  30.         textureImporter.maxTextureSize = 512;
  31.  
  32.         Debug.Log("Applied texture settings to: " + path);
  33.     }
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment