Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Play Audio Script - Volume adjusting

$
0
0
Hi, I am composer and sound designer that is trying to learn some codeing Could You help me and tell me what should i add to change volume to 1.0F when enter trigger using System.Collections; using System.Collections.Generic; using UnityEngine; public class AudioPlay : MonoBehaviour { public AudioClip strings_1; AudioSource audioSource; // Use this for initialization void Start () { audioSource = GetComponent<AudioSource> (); audioSource.PlayOneShot (strings_1, 0.0F ); - when game starts i want it to start but with 0 volume } // Update is called once per frame void Update () { } void OnTriggerEnter2D (Collider2D other) { if(other.gameObject.tag == "slotviolin") { Debug.Log ("coilder works"); // how can i change volume to 1.0F and if it's possible how to make it smooth ? } } } Thanks

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>