• 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 DoctorSauce · Jul 17, 2015 at 07:12 PM · unity 5apiaudioimporter

audioImporter.loadType replacement in Unity 5 API?

So I have just imported an old unity 4 package into my unity 5 game. In one of the editor scripts, it has a few lines like this:

 audioImporter.loadType = AudioClipLoadType.Streaming;

The audioImporter.loadType is just a way to get/set some of the import settings for a particular piece of audio, as far as I can tell.

The problem is, apparently in Unity 5, this code no longer works. I get this error for these lines:

Type UnityEditor.AudioImporter' does not contain a definition for loadType' and no extension method loadType' of type UnityEditor.AudioImporter' could be found (are you missing a using directive or an assembly reference?)

I've looked all through the script reference and whatnot, but I can't seem to find a way to replace this line of code. Is there a way, or am I just kinda screwed and I need to find a new asset?

Thanks in advance for any help!

Comment
Add comment · Show 1
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 Positive7 · Jul 17, 2015 at 07:51 PM 0
Share

As far as I know UnityEditor.AudioImporterLoadType' is obsolete: ' Use UnityEngine.AudioClipLoadType instead.

You can contact the devs of the assets or fix it yourself.

1 Reply

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

Answer by DustyScreen · Jul 06, 2016 at 12:53 PM

I think the reason why they have changed it is, that it's platform specific now.

So if you want to change the default setting, you can do it like:

         AudioImporter audioImporter  = (AudioImporter) assetImporter;
         AudioImporterSampleSettings audioImporterSampleSettings = audioImporter.defaultSampleSettings;
         audioImporterSampleSettings.loadType = AudioClipLoadType.CompressedInMemory;
         audioImporter.defaultSampleSettings = audioImporterSampleSettings;
 
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 Tomer-Barkan · Oct 24, 2017 at 09:15 AM 0
Share

Thanks. I know it's old but works perfectly. Accepted your answer since it seems the OP has disappeared.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

26 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 5 API Updater Keeps Failing 4 Answers

How to Convert This Line to Fit the New API? 1 Answer

For some reason when I updated my project to work with Unity 5 the script updater failed 0 Answers

Getting "API update required" 2 Answers

Compilation error, Unity 5 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges