Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Rxanadu · Dec 25, 2012 at 05:15 PM · guiaudioclip

Displaying song's name in-game

I'm trying to get the name of a song currently playing in my game to appear on-screen, similar to most of the EA Sports games with their licensed music. Currently, I'm able to use 'audio.clip' in a string to print the information out. However, when I tested it with a song from my iTunes library, the following showed up:

" (UnityEngine.AudioClip)"

I can change the name of the file easily, but I'm not sure where to start when removing the '(UnityEngine.AudioClip)' part. Any direction to the will be helpful.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Rxanadu · Jan 05, 2013 at 07:58 PM

@ng93: Turns out you were right in using AudioClip.name to project the name of the song. I still have an issue with creating an audio source with my specified audio clip attached to it.

Aside from that, though, you answered my question. Sorry for not viewing this earlier.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by thehiveissocial · Feb 16, 2019 at 11:35 PM

@Rxanadu @ng93 I'm currently trying to do this for a rhythm style game I'm developing. The game has a list of audio stored and when the player changes songs I would like the text to update along with the song. I'm having trouble with the "AudioClip.name," for some reason I can't get it to work unless I'm doing it incorrectly. I have the Text named "songname." In update I called "songname" and tried songname = AudioClips.name, but I can't call name. I'm new to all this and I'm wondering what I'm missing if anyone can help. Thank you in advance! -David

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tmpfer · Aug 19, 2021 at 10:19 PM 0
Share

Hello, maybe it can work...

if (audioSource.isPlaying) GameObject.Find("SongName").GetComponent().text = audioSource.clip.name.ToString(); else GameObject.Find("SongName").GetComponent().text = "";

In my case "SongName" is a "TEXT object" and son of "CANVAS". It worked in my Rhythm Game Project.

avatar image rage_co tmpfer · Aug 20, 2021 at 04:35 AM 0
Share

yeah you need to use Text.text with the text object...

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Fast forward an audio clip 1 Answer

How to access an AudioClipVariable from other Script c# 0 Answers

NGUI: Recommended way of hiding/showing multiple menu panels? 1 Answer

GUI co-ordinates bug? 1 Answer

in 4.6RC1 uGUI, sprites blocks buttons/scrollrect from clicking/scrolling 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges