Audio clip, import, Inspector - default settings?

NOTE – since about 2014, it’s possible to select more than one AudioClip at the one time.

So, this is only of historic interest, fortunately…


You take a sound file, abc.wav, and drop it in your assets folder

Click on the file in the PROJECT panel, look at the INSPECTOR

4351-imp.png

You can change the values, LoadType etc. But they always begin with the values shown in the image here.

This hurts if you are dropping 100s of sounds in to your assets folder!

(1) is there a way to change the default shown in the image?

(2) is there any way to highlight 100 items in your PROJECT panel, and change the settings all at once?

(I looked on the asset store for a “mass changer,” presumably an editor script, unfortunately could not find one.)

Thanks!


Later - I know nothing about editor scripting, but I cobbled this together. Please ignore my hideous c# ! This may help someone in the future … cheers! You can very easily extend this to other properties in the AudioImporter, or indeed other importers.

////////////////////////////////////// filename AudioSettingsAEN.cs

using UnityEngine;
using UnityEditor;

// audio settings ......... appliquer en masse

// select as many as you want in PROJECT pane (even using folders)
// then use these menu items in the editor.

// you can trivially add more functions as needed, using
// this reference: /Documentation/ScriptReference/AudioImporter.html

// Drop this file in your Assets/Editor/ folder

public class AudioSettingsAEN : ScriptableObject
	{
	
    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: 2D sound")]
    static void  __2D()
		{
		int k=0;
		int tot=0;
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			
			if ( ai.threeD != false )
				{
				ai.threeD = false;
				++k;
				}
			++tot;
			
			AssetDatabase.ImportAsset( path );
			}
		
		Debug.Log("Changed " +k+ " out of " +tot+ " for you.");
		// add reporting code like that in each case if useful to you
		}
	
    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: 3D sound")]
    static void  __3D()
		{
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			ai.threeD = true;
			AssetDatabase.ImportAsset( path );
			}
		}
	
	/////////////////////////////////////////
	
    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: Stream from disc")]
    static void  __stream()
		{
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			ai.loadType = AudioImporterLoadType.StreamFromDisc;
			AssetDatabase.ImportAsset( path );
			}
		}
	
    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: Uncompressed live")]
    static void  __decomp()
		{
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			ai.loadType = AudioImporterLoadType.DecompressOnLoad;
			AssetDatabase.ImportAsset( path );
			}
		}
	
	/////////////////////////////////////////

    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: comp default (156000)")]
    static void  __k156()
		{
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			ai.compressionBitrate = 156000;
			AssetDatabase.ImportAsset( path );
			}
		}
	
    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: comp 128000")]
    static void  __k128()
		{
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			ai.compressionBitrate = 128000;
			AssetDatabase.ImportAsset( path );
			}
		}
	
    [MenuItem ("Utilities/AudioSettingsAEN/change all selected to: comp 96000")]
    static void  __k96()
		{
		foreach (AudioClip ac in GetSelectedAudio())
			{
			string path = AssetDatabase.GetAssetPath( ac );
			AudioImporter ai = AssetImporter.GetAtPath(path) as AudioImporter;
			ai.compressionBitrate = 96000;
			AssetDatabase.ImportAsset( path );
			}
		}
	
	/////////////////////////////////////////
	
    static Object[] GetSelectedAudio()
    	{
        return Selection.GetFiltered( typeof(AudioClip), SelectionMode.DeepAssets );
    	}
	}

///////////////////////////////////////////////////////////////

Hi Fattie. I think this component allows mass changes to component fields: Extended Inspector | Utilities Tools | Unity Asset Store just in case your Uber script doesn’t work out :wink: