Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity audio

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

Audio Unity

private AudioSource audio; // Get the audio
void Start()
{
	audio = GetComponent<AudioSource>();  // Get the component(Add the component first and don't forget to atach the audio)
	PlayAudio(); // Call the PlayAudio Function
}
void PlayAudio()
{
	audio.Play(); // Play the audio use Stop() to stop the audio
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# append array 
Csharp :: roman to int 
Csharp :: c# dictionary values to list 
Csharp :: billboard canvas unity 
Csharp :: check if file exist c# 
Csharp :: string to datetime c# 
Csharp :: recursive reverse linked list 
Csharp :: Squares of a Sorted Array 
Csharp :: c# see if list contains any duplicates 
Csharp :: 1 line if c# 
Csharp :: single line and multiline comments in c# 
Csharp :: list search c# 
Csharp :: C# monogodb 
Csharp :: lcm of numbers 
Csharp :: c# readline char 
Csharp :: unity gui text 
Csharp :: unity text color 
Csharp :: asp.net mvc image upload 
Csharp :: ternary operator c# 
Csharp :: c# enum 
Csharp :: c# is odd number 
Csharp :: text read C# 
Csharp :: dynamic group by expression C# 
Csharp :: unity toint 
Csharp :: pyautopgui erros 
Csharp :: how to make pc bsod C# 
Csharp :: meaning of ??= in c# 
Csharp :: web page search c# 
Csharp :: replace multiple characters in string c# 
Csharp :: how to reload app.config file at runtime in c# 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =