简体   繁体   English

如何在 Unity c# 中获取当前声音剪辑文件名?

[英]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)我正在尝试获取当前歌曲的名称,但作为回报,我得到了名称 + (UnityEngine.AudioClip)

Here's a code I use:这是我使用的代码:

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

Is there a way to get rid of (UnityEngine.AudioClip)?有没有办法摆脱(UnityEngine.AudioClip)? Because right now I get:因为现在我得到:

SongName (UnityEngine.AudioClip)歌曲名称 (UnityEngine.AudioClip)

Thanks in advance!提前致谢!

Suggestions:建议:

I believe this returns you the name of clip...我相信这会返回剪辑的名称...

audioSource.clip.name

Hope it works... Happy coding:)希望它有效......快乐的编码:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM