0
Answered

Change Audio Clip in Audio Source

APetrov 3 years ago updated 3 years ago 3

Hello.

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:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Answered

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.