public override void InitDetailCheckObject(Object obj) { AudioClip clip = obj as AudioClip; AudioChecker checker = currentChecker as AudioChecker; string compression = buildInType; int quality = 0; string sampleRateSetting = buildInType; int overrideSampleRate = 0; string androidOverride = buildInType; string androidLoadType = buildInType; string androidCompression = buildInType; int androidQuality = 0; string androidSampleRateSetting = buildInType; int androidSampleRate = 0; string iosOverride = buildInType; string iosLoadType = buildInType; string iosCompression = buildInType; int iosQuality = 0; string iosSampleRateSetting = buildInType; int iosSampleRate = 0; AudioImporter importer = AudioImporter.GetAtPath(assetPath) as AudioImporter; if (importer != null) { compression = importer.defaultSampleSettings.compressionFormat.ToString(); quality = Mathf.Clamp((int)(importer.defaultSampleSettings.quality * 100), 1, 100); sampleRateSetting = importer.defaultSampleSettings.sampleRateSetting.ToString(); overrideSampleRate = (int)importer.defaultSampleSettings.sampleRateOverride; AudioImporterSampleSettings androidSettings = importer.GetOverrideSampleSettings(platformAndroid); androidOverride = importer.ContainsSampleSettingsOverride(platformAndroid).ToString(); androidLoadType = androidSettings.loadType.ToString(); androidCompression = androidSettings.compressionFormat.ToString(); androidQuality = Mathf.Clamp((int)(androidSettings.quality * 100), 1, 100); androidSampleRateSetting = androidSettings.sampleRateSetting.ToString(); androidSampleRate = (int)androidSettings.sampleRateOverride; AudioImporterSampleSettings iosSettings = importer.GetOverrideSampleSettings(platformIOS); iosOverride = importer.ContainsSampleSettingsOverride(platformIOS).ToString(); iosLoadType = iosSettings.loadType.ToString(); iosCompression = iosSettings.compressionFormat.ToString(); iosQuality = Mathf.Clamp((int)(iosSettings.quality * 100), 1, 100); iosSampleRateSetting = iosSettings.sampleRateSetting.ToString(); iosSampleRate = (int)iosSettings.sampleRateOverride; } checkMap.Add(checker.audioLength, clip.length); checkMap.Add(checker.audioType, clip.loadType.ToString()); checkMap.Add(checker.audioChannel, clip.channels); checkMap.Add(checker.audioCompression, compression); checkMap.Add(checker.audioQuality, quality); checkMap.Add(checker.audioSampleRateSetting, sampleRateSetting); checkMap.Add(checker.audioSampleRate, overrideSampleRate); checkMap.Add(checker.audioPostfix, ResourceCheckerHelper.GetAssetPostfix(assetPath)); checkMap.Add(checker.audioAndroidOverride, androidOverride); checkMap.Add(checker.audioAndroidLoadType, androidLoadType); checkMap.Add(checker.audioAndroidCompressionFormat, androidCompression); checkMap.Add(checker.audioAndroidQuality, androidQuality); checkMap.Add(checker.audioAndroidSampleRateSetting, androidSampleRateSetting); checkMap.Add(checker.audioAndroidSampleRate, androidSampleRate); checkMap.Add(checker.audioIOSOverride, iosOverride); checkMap.Add(checker.audioIOSLoadType, iosLoadType); checkMap.Add(checker.audioIOSCompressionFormat, iosCompression); checkMap.Add(checker.audioIOSQuality, iosQuality); checkMap.Add(checker.audioIOSSampleRateSetting, iosSampleRateSetting); checkMap.Add(checker.audioIOSSampleRate, iosSampleRate); }
public override void InitDetailCheckObject(Object obj) { TextureChecker checker = currentChecker as TextureChecker; Texture tex = obj as Texture; string format = "Special"; if (tex is Texture2D) { Texture2D tex2D = tex as Texture2D; format = tex2D.format + "\n" + tex2D.width + " x " + tex2D.height + " " + tex2D.mipmapCount + "mip "; } else if (tex is Cubemap) { Cubemap texCube = tex as Cubemap; format = texCube.format + "\n" + tex.width + " x " + tex.height + " x6 "; } TextureImporter texImporter = TextureImporter.GetAtPath(assetPath) as TextureImporter; string mip = buildInType; string readable = buildInType; string type = buildInType; string npotScale = buildInType; int anisoLevel = 1; int texOriSize = 0; string androidOverride = buildInType; int androidMaxSize = 0; string androidFormat = buildInType; string androidCompressQuality = buildInType; string iosOverride = buildInType; int iosMaxSize = 0; string iosFormat = buildInType; string iosCompressQuality = buildInType; #if UNITY_5_5_OR_NEWER string alpha = buildInType; string compression = buildInType; #else string alphaFromGray = buildInType; string alphaIsTran = buildInType; string sourceAlpha = buildInType; #endif if (texImporter) { mip = texImporter.mipmapEnabled.ToString(); readable = texImporter.isReadable.ToString(); type = texImporter.textureType.ToString(); npotScale = texImporter.npotScale.ToString(); anisoLevel = texImporter.anisoLevel; texOriSize = GetOriTextureSize(texImporter); #if UNITY_5_5_OR_NEWER TextureImporterPlatformSettings androidsettings = texImporter.GetPlatformTextureSettings(platformAndroid); androidOverride = androidsettings.overridden.ToString(); androidMaxSize = androidsettings.maxTextureSize; androidFormat = androidsettings.format.ToString(); androidCompressQuality = GetCompressionQuality(androidsettings.compressionQuality); TextureImporterPlatformSettings iossettings = texImporter.GetPlatformTextureSettings(platformIOS); iosOverride = iossettings.overridden.ToString(); iosMaxSize = iossettings.maxTextureSize; iosFormat = iossettings.format.ToString(); iosCompressQuality = GetCompressionQuality(iossettings.compressionQuality); alpha = texImporter.alphaSource.ToString(); compression = texImporter.textureCompression.ToString(); #else TextureImporterFormat androidImportFormat; int androidImportCompressionQa; androidOverride = texImporter.GetPlatformTextureSettings(platformAndroid, out androidMaxSize, out androidImportFormat, out androidImportCompressionQa).ToString(); androidFormat = androidImportFormat.ToString(); androidCompressQuality = GetCompressionQuality(androidImportCompressionQa); TextureImporterFormat iosImportFormat; int iosImportCompressionQa; iosOverride = texImporter.GetPlatformTextureSettings(platformIOS, out iosMaxSize, out iosImportFormat, out iosImportCompressionQa).ToString(); iosFormat = iosImportFormat.ToString(); iosCompressQuality = GetCompressionQuality(iosImportCompressionQa); alphaFromGray = texImporter.grayscaleToAlpha.ToString(); alphaIsTran = texImporter.alphaIsTransparency.ToString(); //5.5之前可以用 sourceAlpha = texImporter.DoesSourceTextureHaveAlpha().ToString(); #endif } int memSize = CalculateTextureSizeBytes(tex) / 1024; int size = Mathf.Max(tex.width, tex.height); bool isSquare = tex.width == tex.height; bool isPoworOfTwo = TextureIsPowerOfTwo(tex); string postfix = ResourceCheckerHelper.GetAssetPostfix(assetPath); checkMap.Add(checker.texFormat, format); checkMap.Add(checker.texMipmap, mip); checkMap.Add(checker.texReadable, readable); checkMap.Add(checker.texType, type); checkMap.Add(checker.texMemSize, memSize); checkMap.Add(checker.texSize, size); checkMap.Add(checker.texPostfix, postfix); checkMap.Add(checker.texAnisoLevel, anisoLevel); checkMap.Add(checker.texIsSquareMap, isSquare.ToString()); checkMap.Add(checker.texNonPowerOfTwo, isPoworOfTwo.ToString()); checkMap.Add(checker.texNpotScale, npotScale); checkMap.Add(checker.texWrapMode, tex.wrapMode.ToString()); checkMap.Add(checker.texFilterMode, tex.filterMode.ToString()); checkMap.Add(checker.texOriSize, texOriSize); checkMap.Add(checker.texAndroidOverride, androidOverride); checkMap.Add(checker.texAndroidMaxSize, androidMaxSize); checkMap.Add(checker.texAndroidFormat, androidFormat); checkMap.Add(checker.texAndroidCompressQuality, androidCompressQuality); checkMap.Add(checker.texIOSOverride, iosOverride); checkMap.Add(checker.texIOSMaxSize, iosMaxSize); checkMap.Add(checker.texIOSFormat, iosFormat); checkMap.Add(checker.texIOSCompressQuality, iosCompressQuality); #if UNITY_5_5_OR_NEWER checkMap.Add(checker.texAlpha, alpha); checkMap.Add(checker.texCompression, compression); #else checkMap.Add(checker.texAlphaFromGray, alphaFromGray); checkMap.Add(checker.texAlphaIsTransparent, alphaIsTran); checkMap.Add(checker.texSourceAlpha, sourceAlpha); #endif }