Change Audio Clip in Audio Source

APetrov 4 years ago updated 4 years ago 3


Can I change the Audio Clip in Audio Source while the application is running?

However, knowing only the name Audio Clip in Assets.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

It's generally not recommended to refer to assets by name in Unity. It's better to directly link your audio clip in the field there (that currently shows up as "None"). Otherwise, you can place it in a Resources folder and use Resources.Load. More information about that technique here: https://docs.unity3d.com/ScriptReference/Resources.Load.html

Thank you, you helped me a lot.