Arthur Belkin
Arthur Belkin

Reputation: 135

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!

Upvotes: 0

Views: 1565

Answers (1)

Sherry
Sherry

Reputation: 332

Suggestions:

I believe this returns you the name of clip...

audioSource.clip.name

Hope it works... Happy coding :)

Upvotes: 4

Related Questions