//mutes audiosource and toggles the image for the button used
 public void ToggleSound()
 {
     audiosource.mute = !audiosource.mute;
     if (isButton)
     {
         toggleButton.ToggleSprite();
     }
 }
 void Update()
 {
     //When pressing esc, set chosen gameobject as active, in this case a menu
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         ToggleActive();
         pauseButton.ToggleSprite();
     }
 }