Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Fattie · Oct 23, 2012 at 08:40 AM · inspectorproject

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

alt text

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 );
         }
     }
 
 ///////////////////////////////////////////////////////////////



imp.png (26.0 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tim-Michels · Oct 23, 2012 at 09:41 AM 1
Share

Unfortunately, multi-object editing isn't supported for Audio yet. It will probably be enabled in Unity 4, but up until now, I've always had to edit each audio-file seperately.

The only way to achieve what you want is to write your own EditorScript. I assume it's not all that hard, because there are specific functions for what you would need. Here's something that might help you:

http://docs.unity3d.com/Documentation/ScriptReference/AssetPostprocessor.OnPreprocessAudio.html

and

http://docs.unity3d.com/Documentation/ScriptReference/AssetPostprocessor.html

Hope I could help you on your way, too bad it's not yet supported by the Unity Editor itsself.

avatar image Fattie · Oct 23, 2012 at 09:56 AM 1
Share

right on Tim, thanks. I cobbled a editor script, I will foist it on the world in an answer here ... cheers

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by code-blep · Oct 25, 2012 at 10:43 PM

Hi Fattie. I think this component allows mass changes to component fields: http://u3d.as/content/bovine-labs/extended-inspector/2rY just in case your Uber script doesn't work out ;)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Nov 01, 2012 at 01:07 PM 0
Share

that's a really great tip - thanks! Rock On.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Inspector Panel Broken 2 Answers

Project view script settings not being used 0 Answers

How can I regenerate the an objects icon in the Project window? 0 Answers

My Project view is broken Help! 0 Answers

Jump back to Prefab in Project view when selected there 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges