Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Unity 5 AudioMixer nullreference on iOS using IL2CPP

Discussion in 'Audio & Video' started by AstroMalte, Mar 24, 2015.

  1. AstroMalte

    AstroMalte

    Joined:
    Mar 5, 2014
    Posts:
    5
    Hi all,
    I don't know if I missed something obvious regarding IL2CPP, the new AudioMixer and iOS, but I cant find any information about my nullreference problem.

    I found this thread that also share my issue:
    http://forum.unity3d.com/threads/unity-5-audiomixer-and-audiomixersnapshots-problem-on-ios.298233/

    The AudioMixer, AudioMixerGroup and AudioSnapshot are all assigned via public variables, like in the thread above.
    • When I build for iOS using IL2CPP (I've tried with both Universal or ARMv7 Architecture) I get a nullreference for all assigned variables.
    • When I build for iOS using Mono I DON'T get the nullreferences.

    I'm using Unity 5.0.0f4 (also tried Unity 5.0.0p4), latest Xcode 6.2 on a MacBook Air with OS X Yosemite.
    Test device: iPhone5 v 8.2.

    Does anyone have an idea or good information about this issue?

    Thanks!
     
  2. Diet-Chugg

    Diet-Chugg

    Joined:
    Jul 4, 2012
    Posts:
    51
  3. AstroMalte

    AstroMalte

    Joined:
    Mar 5, 2014
    Posts:
    5
    If this is the case, I'm surprised that I can't find more posts from users that has encountered this problem.

    Thank you for the answer!
     
  4. TimSchroeder

    TimSchroeder

    Joined:
    Aug 27, 2014
    Posts:
    9
    We have the same problem. We assign a AudioMixer to a public variable of a script and try to access it. It works in the editor and on standalone / web builds. On iOS we get the null reference. Same behavior if we load the AudioMixer via Resources.Load on runtime.

    Does anyone have a workaround for this problem? We want to change the volume from a script.
     
    joihelgi likes this.
  5. joihelgi

    joihelgi

    Joined:
    Jan 21, 2014
    Posts:
    19
    This is the same problem for me, and it's a major one. It renders the AudioMixer useless and I am already counting on snapshots and effects. Also why isn't obvious features like mute accessible from code?

    I'm curious, is happening for everyone building in IL2CPP or just the devs hoping to release after few weeks?
     
    Last edited: Apr 15, 2015
  6. AstroMalte

    AstroMalte

    Joined:
    Mar 5, 2014
    Posts:
    5
    Luckily I don't have a tight deadline and I don't want to throw my AudioMixer implementation (it works really good!) and rewrite the code.

    I also miss solo and mute for each mixer and groups.

    5.0.1 was released the other day but I haven't got time to try it out yet and I don't know if this issue is fixed.
     
  7. Zimbo

    Zimbo

    Joined:
    Jul 11, 2012
    Posts:
    8
    Feeling stupid, I only discovered one week ago that Apple does not accept Unity MONO builds anymore. This IL2CPP-thing exists for some time now?

    Anyway, my heavy-scripted procedural worlds & audio generating game did not work with IL2CPP. After a week of trial & error (and a lot of cursing. sorry) i disabled the Audiomixer, and the game (a handicapped version) finally runs with IL2CPP. In 5.0.1p1 (5.0.1 with patch 1)

    So I think Audiomixer is stil broke, I think...

    @AstroMalte: I am also surprised there are not so many posts on problems with IL2CPP. I am also surprised not many devs are complaining about bad (worse than mono) performance.
    But now I will: Imageeffects perform a lot worse. In my game, when a Twirl effect kicks in, frame rate drops from 27 on 17 (on a iPad 3)[/QUOTE]
     
  8. FinalD

    FinalD

    Joined:
    Apr 4, 2013
    Posts:
    4
    This issue still hasn't been fixed, and unfortunately we do have a firm release date on iOS.

    I am currently trying to remove all references to the AudioMixer in the project because of it for a demo, hoping they get a fix in soon so we can use it for the final release. If not, we will need to re-work and re-export hundreds of sounds...

    Also, its very irritating that you can't search for and get a reference to AudioMixers you have through the existing API - we dynamically instantiate a lot of stuff from scripts (including sound sources) and the only work around I have found to assign a sound source to an specific mixer-group (like VO or sfx for example) is to have my master mixer saved as a public variable to an existing gameobject elsewhere in my scene and have accessor methods to get references to it - effectively making it a global variable.
     
  9. Zimbo

    Zimbo

    Joined:
    Jul 11, 2012
    Posts:
    8

    Hello Daniel,

    There's a new patch: 5.0.1p2. It seems the Audiomixer reference problem is solved in this version. Our 'work in progress' project now compiles successfully with IL2CPP, including all the Audiomixer-goodness.

    But... overall performance, in comparison with the old Mono-build, is still worse, especially for Image Effects...
     
  10. piacentini

    piacentini

    Joined:
    May 27, 2014
    Posts:
    28
    I reported this as well, case 6933. Exact same issues.
    The problem is that updating to the latest patch release (p4) breaks other stuff in my app. Is p2 stable for you guys?