I’ve been trying to play a sound file attached to the door gameobject via a controller, a god x) , script.
public GameObject door;
void Update()
{
if(done == 1) //some condition
{
door.audio.play(/*need the name of clip here*/);
// also PlayOneShot doesn't seem to get it right, If I could reference the string
// in it
}
}
I am little confused, my door gonna 2 audio files, how could it be possible since the audiosource only take 1 file and if the file is played from the controller script won't the 3D sound come from controller and not the door? It would sound weird maybe 0 as the controller(an empty gameobject) would not be near the player.
– yusolaifdferalright I think I got it, btw how would you play the sound clip finally ? Cause it says the value of sound is assigned but never used
– yusolaifdferaudio.PlayOneShot(sound);
– KMKxJOEY1