I’m working on an audio manager class and I have a problem. When I want to play a sound in my scene I use a method that creates a gameObject and places it in a position I set. Then the method adds to the gameobject an audiosource that I pass it by parameter and I keep the reference. This way:
“minVolume is not supported anymore. Use min-, maxDistance and rolloffMode instead.”
“maxVolume is not supported anymore. Use min-, maxDistance and rolloffMode instead.”
“rolloffFactor is not supported anymore. Use min-, maxDistance and rolloffMode instead.”
I have tried to add a new audiosource and then copy the properties of _source one by one but I cant copy the rolloffCustom curve, so I don’t know what to do.
You’ve never been able to copy the custom curve through script, and this won’t be changing in Unity 5 either. The only way to do it is copy the entire component from elsewhere, then change everything else via script. That’s what we do in Master Audio.
Not sure if that works outside of a custom inspector class. This copies an AudioSource component from one object to another. Just make sure to delete any AudioSources on the destination object first as well.
Hey jerotas. Now I have another problem. The namespaces UnityEditor or UnityEditorInternal are not included when you build for a platform. Those are only included when working in the actual UnityEditor.
Yeah I used a conditional compile directive so that that part of code only compiles while in the editor, not when exporting. I can look that up if you can’t find it. Let me know.