How can I turn off the sound from another scene?
I attached music file to my first scene and thanks to following javascipt code, it works without stopping in other scenes.
 public static var object : SingletonMusic = null;
  
 function Awake()
 {
     
     if( object == null )
     {
         object = this;
         DontDestroyOnLoad(this);
     }
     else if( this != object )
     {
         Destroy( gameObject );
     }
 }
 
               My problem is that I want to turn off the sound from the button in the another scene (setting scene) so that I added a new button to my setting scene and attached the following javascript code to button that I have created.
Javascript code:
 var objects: AudioSource = SingletonMusic.object.GetComponent(AudioSource);
 if( objects.isPlaying )
     objects.Pause();
 else
     objects.Play();
 
 
               However, it gives following errors:
If I start the game from Setting scene, I get this error: 
If I start the game from first scene, I get this error: 
               Comment
              
 
               
              Your answer