- Home /
Several audiosources play at the same time
I have scripts that includes audio. This one is attached to an enemy and would follow the player. I want to play audio at the same time, but there are too many audios playing at the same time, so the noise is sharp and unclear.
This is my script:
void FollowPlayer()
{
closestplayer = GameObject.FindGameObjectWithTag(PlayerTag);
gameObject.transform.position = Vector2.MoveTowards(transform.position, GameObject.FindGameObjectWithTag(PlayerTag).transform.position, EnemySpeed * Time.deltaTime);
AudioSource.PlayClipAtPoint(MoveClip, transform.position);
}
The MoveClip is a clip that plays when moving(Foot steps).
What is wrong in my script? Here are some Images:
This is what happens when I start the game:
Can anyone help me please?! Thank you!
You dont need to write gameObject.
in the line that starts with gameObject.transform.position =
. Use just transform.position =
Answer by jstopyraIGG · Feb 13, 2019 at 03:32 AM
Try setting Spatial Blend to 3D. if audio is 2D, it plays at the same volume no matter how far the Audio Source is, if its 3D, it will get quieter when its further.
Your answer
Follow this Question
Related Questions
Question about audio (AudioSource). My ingame sound doesn't sound like the original audio file? 3 Answers
How to manage player and enemies shooting sounds at the same time? 1 Answer
How can I play multiple audioclips from the same object? 2 Answers
Play audio clip without a variable 1 Answer
Is there a way to create a random Audiosource loop? 2 Answers