How to get current sound clip file name in Unity c#?

I have a script that basically plays music from the list. I’m trying to get a name of the current song but in return I get the name + (UnityEngine.AudioClip)

Here’s a code I use:

currentSong.text = audioSource.clip.ToString();

Is there a way to get rid of (UnityEngine.AudioClip)? Because right now I get:

SongName (UnityEngine.AudioClip)

Thanks in advance!

>Solution :

Suggestions:

I believe this returns you the name of clip…

audioSource.clip.name

Hope it works… Happy coding 🙂

Leave a Reply