- Home /
 
Script using a Pause library causes audio to intermittently cutout.
The audio from my MainCamera object seems to be played through but its a bit intermittent and jerky sound with this script enabled:
 using UnityEngine;
 using System.Collections;
 
 public class MyiPhoneTouchPause : MonoBehaviour {
     
     public GameObject pauseMenuUI;
     public EleckTek.PauseController[] pauseControllers ; 
     public Spin spinner ; 
     public GameObject mySound;
     
     public GUIStyle playButtonStyle;
     public Texture playButtonTexture;
     public Texture pauseButtonTexture;
     public Texture currentSmallButtonTexture;
     
     bool myActivated ; 
     string pplay = "PLAY";
     // Use this for initialization
     void Start () {
         myActivated = true;
         foreach( EleckTek.PauseController pause in pauseControllers )
             {
             pause.activatePause = myActivated;
             }
     }
     
     
     
     void OnGUI()
     {
         
         double halfOfImage = playButtonTexture.width*0.5;
         float halfOfImagef = (float)halfOfImage;
         
         if(myActivated == true){
         currentSmallButtonTexture = playButtonTexture;    
             
         if( GUI.Button( new Rect( (0.5f * Screen.width)-halfOfImagef, 0.1f * Screen.height, playButtonTexture.width, playButtonTexture.height), playButtonTexture, playButtonStyle))
         {
             Debug.Log("GUI Button + myactivated true");
             //Instantiate(mySound);
             myActivated = !myActivated ; 
             pauseMenuUI.SetActiveRecursively(myActivated);
             foreach( EleckTek.PauseController pause in pauseControllers )
             {
             pause.activatePause = myActivated ; 
             }
         }
         } else {
             Debug.Log("myactivated false");
         currentSmallButtonTexture = pauseButtonTexture;    
         }
 
         
         if( GUI.Button( new Rect( 0.0f * Screen.width, 0.95f * Screen.height, .2f * Screen.width, .05f * Screen.height), new GUIContent( currentSmallButtonTexture,"" ) ) )
         {
             
             
             //Instantiate(mySound);
             myActivated = !myActivated ; 
             foreach( EleckTek.PauseController pause in pauseControllers )
             {
                 pause.activatePause = myActivated ; 
                 pauseMenuUI.SetActiveRecursively(myActivated);
                 if(myActivated == true){
                     pplay = "PLAY";
                 }
                 if(myActivated == false){
                     pplay = "MENU";
                 }
             
                 
             }
             
         }
         
     }
 }
 
               Anyone know tests or settings I can change on the audio to see what might be causing intermittent jerky sounds on the audio track?
               Comment
              
 
               
              Your answer