|
Hi, I'm trying to make a phone ring and when you get near it the ringing stops and a voice audio takes its place. I just can't seem to do it though. I wrote the script but it says "Play" isnt part of Unity Engine Audio Clip. Here is my script:
(comments are locked)
|
|
Play() is for an audio source, not an audio clip. You have to assign the audio clip to the audio source if you haven't already, then do My script is attached to my Player since its collision, i need my player to like touch the phone and then the audio plays. So can you throw that by me again? My audio clip is attached to the source.
Apr 08 '10 at 02:37 AM
DTJ Productions
@DTJ Productions: see the edit I made to my answer.
Apr 08 '10 at 04:51 AM
Eric5h5
Thanx that worked, I only have one problem- turning the ringing off when I touch the "hippo" game object. Please help
Apr 10 '10 at 01:47 AM
DTJ Productions
@DTJ Productions: If the ringing is being produced by the "hippo" object's audio source, then replacing it with "myAudioFile" like the script already does should stop the ringing.
Apr 10 '10 at 03:14 AM
Eric5h5
That did not help, I have a noise playing "On Awake" and need it to stop the time I touch the object or the time the other audio turns on.
Apr 10 '10 at 04:47 AM
DTJ Productions
(comments are locked)
|
|
You need to access the Audio Source Component of the phone GameObject, then tell that to play. I think this will work:
Or you can make "phone" a public variable and set it in the Editor. Hey I was wondering for the OnControllerColliderHit function and it says phone.audio.Play(); Do I name my audio sound that I want to play "phone"?
Apr 09 '10 at 01:23 AM
DTJ Productions
Oh and also (sorry for these idiotic questions) I was wondering what to tag the object I want to touch and play the sound, and what to name it. thanks
Apr 09 '10 at 01:25 AM
DTJ Productions
See Eric's answer. I think it'll work better for you in this case.
Apr 10 '10 at 12:03 AM
Design3.com
(comments are locked)
|
