Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity c# audio source

using System.Collections;
using UnityEngine;

public class AudioManager : MonoBehaviour
{
    [SerializeField]
    private AudioSource sampleAudioSource = null;

    void Awake(){
		if (sampleAudioSource == null)
            Debug.LogError("AUDIO_MANAGER: sampleAudioSource is NULL");
    }

    public void PlaySampleSound()
	{
    	sampleAudioSource.Play();
    }
}
Comment

unity audio source

m_MyAudioSource.Play();
Comment

access audio source from gameobject unity

AudioSource source1 = GameObject.FindGameObjectWithTag("GameObject1").GetComponent<AudioSource>();

GetComponent<AudioSource>().clip = source1.clip;
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to get specific length of row in matrix c# 
Csharp :: roman 
Csharp :: c# break from foreach method 
Csharp :: c# select first value from list 
Csharp :: parsing string to int c# 
Csharp :: c# enum default 
Csharp :: fluent assertion exception 
Csharp :: Gameobject.Find in unityC# 
Csharp :: change color of object unity 
Csharp :: c# clear all textboxes 
Csharp :: wpf color picker 
Csharp :: unity check gameobject active 
Csharp :: round decimal two places 
Csharp :: lcm of list of number 
Csharp :: c# foreach object in array json 
Csharp :: c# how to check if a array bool is all true 
Csharp :: list to array c# 
Csharp :: file to byte array 
Csharp :: c# datetime for filename 
Csharp :: what is reflection in programming 
Csharp :: c# get custom attribute from property 
Csharp :: c# convert list to array function 
Csharp :: how to find current country c# 
Csharp :: c# #region #endregion 
Csharp :: c# handle single quote inside string 
Csharp :: Reverse Coding Challenge 1 
Csharp :: All Possible SubString 
Csharp :: how to make a string a list of characters c# 
Csharp :: unity gameobject find inactive 
Csharp :: c# form set auto scale 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =