Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by DTJ Productions · Apr 07, 2010 at 10:23 PM · erroraudioplaysyntax-errorbce0019

Can't play audio file

Hey, I'm trying to make a telephone ring, and when you get close to it, the ringing stops and another audio plays. I can't seem to get the audio to stop and the other audio to play like when I touch it or something else. I tried this:

function OnControllerColliderHit(hit : ControllerColliderHit) { if(hit.collider.gameObject.tag == "audiostart") { myAudioFile.Play();

 }

and it says

Assets/Scripts/collisions 1.js(21,29): BCE0019: 'Play' is not a member of 'UnityEngine.AudioClip'.

Please help

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 Nicolaj Schweitz · Apr 08, 2010 at 10:01 AM

Unity tells you that you are trying to play an audio clip. You can't do it like that.

What you need to do is to attach the clip to an audio source, then tell the audio source to play.

Im short, a clip is a file that has to be put on a audio source component on a gameobject. Then you can handle the audio.

http://unity3d.com/support/documentation/Manual/Sound.html explains the terms in more depth.

Comment
Add comment · Show 1 · 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 DTJ Productions · Apr 09, 2010 at 01:28 AM 0
Share

I did attach it to an audio source. Here is what Ive got; two audio sources on one object; The first audio source is a play when awake, to play ringing. The second audio source is not on awake, I want that to play when I touch the gameObject.

avatar image
0

Answer by straydogstrut · Apr 07, 2010 at 10:35 PM

Take a look at this question which explains the different methods of playing audio.

Comment
Add comment · Show 1 · 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 DTJ Productions · Apr 08, 2010 at 02:13 AM 0
Share

Thanx I read that, but sorry that didn't solve my entire issue. It helped though.

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

No one has followed this question yet.

Related Questions

Accessing array in another script - Error message 2 Answers

I got a major question 1 Answer

rigidbody' is not a member of 'UnityEngine.Object ? 4 Answers

Enabling / Disabling C# Scripts - Why am I getting the error "not a member of 'UnityEngine.Component'"? 1 Answer

Script Error (js) 1 Answer


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