radio off and on

I have a radio that I want the player to be able to turn off and on, the problem is my script turns set the audio to active but when the i got to turn it of it just restarts it
any suggestions would be nice

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RadioTune : Interactable
{
	public GameObject tune;

    public override void OnFocus()
	{
		
	}
	public override void OnInteract()
	{
		if (tune.activeInHierarchy == true)
		{
			tune.SetActive(false);
		}


		if (tune.activeInHierarchy == false)
		{
			tune.SetActive(true);
		}	
	}
	public override void OnLoseFocus()
	{
		
	}
}

Hello, if your goal is that the audio file continues to play on your radio even when it is switched off, then it is probably easiest to control this directly via the mute property. Make sure your audio source has “play on awake” enabled and write something like this:

private AudioSource audioSource;

private void Awake()
{
    audioSource = GetComponent<AudioSource>();
}

private void OnInteract()
{
    audioSource.mute = audioSource.mute ? false : true;
}

Of course, this is not the best way to save performance, but it is the fastest and easiest in comparison. If you want to deactivate the entire object, you would still have to track the time so that you can re-enter at the right point in the audio file when you activate it.