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 :: unity overlapspherenonalloc 
Csharp :: convert memorystream to byte array c# 
Csharp :: c# loop array backwards 
Csharp :: unity c# rate game 
Csharp :: c# web scraping get images from specific url 
Csharp :: unity new input system get button down 
Csharp :: euler angles to quaternion unity 
Csharp :: build a project from dotnet using cli 
Csharp :: freelance 
Csharp :: Selecting item from listview in C# 
Csharp :: do loop c# 
Csharp :: Unity inverse kinematics nothing is happening 
Csharp :: C# a program to reverse each word in the given string. 
Csharp :: flsa itextsharp 
Csharp :: generate random string 
Html :: font-awesome envelope 
Html :: how to change a favicon in html 
Html :: how to make a whatsapp hyperlink html 
Html :: html chevron 
Html :: input type file accept only images 
Html :: html video disable right click 
Html :: how to show iframe in full width 
Html :: bootstrap 4 image fit to div 
Html :: facebook share link html 
Html :: html start 
Html :: onclick alert javascript 
Html :: font awesome 5 pro 
Html :: href rel 
Html :: how to add image caption in markdwon 
Html :: html select default 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =