- Home /
Question by
Borzi · Aug 31, 2013 at 08:36 AM ·
audiofpsaudio sourcefirstpersoncontrolleraudio priority
Play Audio from different Object
A small and (hopefully) simple question to answer. I have a script where an audio clip is played, but I don't want that audio clip to be played on the object (had I added an audio source), but on my character controller. Anyone know how I could to that?
Comment
Already did. The script is not attached to the player though
Best Answer
Answer by legion_44 · Aug 31, 2013 at 09:53 AM
You have to do something like this:
//C# code by Paul Ignasiak
AudioClip clip;
Transform player;
void PlayAudio()
{
AudioSource.PlayClipAtPoint(player.position, clip); //or clip, player
//cant remember that ;/.
}
Yep this is pretty much the right way to do it. Note: "player" needs to be a vector 3, so a position and not a transform for this to work.
Your answer
Follow this Question
Related Questions
Audio Sounds Blurring Together 0 Answers
Audiosurf style audio analysis (unity 3.5) 3 Answers
Cursor Not Centered 0 Answers
Ambisonic Audio working on PC but not Android 3 Answers
Footstep audio for FPS 1 Answer