Unity 滑动条Slider控制音量大小(笔记)

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

public class Change_volume : MonoBehaviour {
 
   public float volume = 0;
    // Use this for initialization
    void Start () {

    }
	
	// Update is called once per frame
	void Update () {
    }
    public void ChangeVolume(float volumeNew)
    {
        GetComponent<AudioSource>().volume = volumeNew;
      
    }
}

猜你喜欢

转载自blog.csdn.net/lrh15980692010/article/details/76570616