page.phpテンプレートを利用しています。
using UnityEngine;
using UnityEngine.UI;
public class SoundPlay : MonoBehaviour
{
AudioSource audioSource;
private bool toggle;
public Slider slider;
void Start()
{
audioSource = GetComponent();
toggle = true; //初期設定
slider.onValueChanged.AddListener(value =>
this.audioSource.volume = value);
}
//button onClick
public void PlayStart()
{
if (toggle)
{
audioSource.Play();
toggle = false;
}
else
{
audioSource.Stop();
toggle = true;
}
}
}