Searching Audio by Tag and change volume HELP
Hi!
I would like to create the sound settings for individual sounds with the tag "SFX" and "Music" and do not know how. I have a script.
C# script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
public class Volume : MonoBehaviour {
public Slider volumeMusicSlider;
public float volumeMusicFloat;
public Text volumeMusicText;
public AudioSource[] musicobj;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
AudioSource musicobj = GameObject.FindGameObjectWithTag("Music").GetComponent<AudioSource>();
for (int i=0; i < musicobj.Length; i++){
AudioListener.musicobj[i] = volumeMusicSlider.value;
}
}
}
How do search source on the tag and change the volume?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612105818im_/https://answers.unity.com/themes/thub/images/avi.jpg)