Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5 Audiomixer and AudioMixerSnapshots problem on ios

Discussion in 'Audio & Video' started by AnimosusIII, Feb 15, 2015.

  1. AnimosusIII

    AnimosusIII

    Joined:
    Nov 8, 2012
    Posts:
    18
    Hi,

    I'am trying to use audiomixer snapshots in my app for iPad , but I have hard time to making it work. It works perfect in the editor but doesn't work on iPad device. I am getting null exception on iPad.

    Short piece of code :

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.UI;
    4. using UnityEngine.Audio;
    5.  
    6. public class QuickMenu : MonoBehaviour {
    7. public AudioMixerSnapshot normal;
    8. public AudioMixerSnapshot pause;
    9.  
    10. public void OnPause()
    11. {
    12. pause.TransitionTo(0.1f);
    13. }
    14. public void OnResume()
    15. {
    16. normal.TransitionTo(0.1f);
    17. }
    18. }
    19.  
    As I said before I am getting null exception on iPad once when I call OnPause() method , but it works in editor. Any idea ? Thanks in advance.
     
    Last edited: Feb 15, 2015
  2. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    More details would help. Is it the AudioMixerSnapshot pause object that's null? In that case, is "normal" null too on iOS? How are you are assigning to these fields, code ore drag and drop? Etc...
     
  3. AnimosusIII

    AnimosusIII

    Joined:
    Nov 8, 2012
    Posts:
    18
    Hi, thanks for reply ,

    I have made snapshot in editor and I have a assigned them to those fields in editor by drag and drop . Yes on the iPad I have receive null exception for normal and pause variable.

    By the way , how I can assign those field from script any idea ?

    Thanks
     
  4. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Haven't explored snapshots much yet, but that looks like a bug. Check for null in Awake, see what happens... If the AudioMixerSnapshot objects you assigned in the inspector magically disappear when running on the device, then yeah, it's a bug. Just try a standalone build to be sure it's device specific.
     
  5. AnimosusIII

    AnimosusIII

    Joined:
    Nov 8, 2012
    Posts:
    18
    Thanks, I will check that and I will post results :D
     
  6. AstroMalte

    AstroMalte

    Joined:
    Mar 5, 2014
    Posts:
    7
  7. AnimosusIII

    AnimosusIII

    Joined:
    Nov 8, 2012
    Posts:
    18
    Actually I made work around , I didn't use mixer for script manipulation only for static editor audio configurations , but I have to check again with new version of Unity 5 :D.
     
  8. Cuicui_Studios

    Cuicui_Studios

    Joined:
    May 3, 2014
    Posts:
    72
    I´m having the same problems with the latest Unity version. My audio mixers setup only works in editor. And we have the game ready for the store :(
     
  9. AstroMalte

    AstroMalte

    Joined:
    Mar 5, 2014
    Posts:
    7