Home > other >  God: hello, second shots will cover the first shots, lead to no
God: hello, second shots will cover the first shots, lead to no

Time:09-23

Now want to add the shooting of the characters of gunfire, I the characters add Audio Source, after shooting signal detected, was broadcast voice:
MyAudio. Play ();
If it is a single shot work perfect, continuous shooting, but if the next shot voice coming, will cause the last shot voice only play a little bit would halt, very depressed,
Excuse me, is there any way for the next shot does not affect the last voice voice broadcast, let the last time also can be completed?

CodePudding user response:

Add sound to bullets instead of a gun or people, probably is the effect you want,

CodePudding user response:

Two methods,
1, the play of the code in a separate thread
2, if the engine is written by yourself, more simple, voice broadcast trigger point has its own ends, itself is not affected by other interference

CodePudding user response:

I usually play the sound element I will create a obj alone to deal with these objects through object pool to the management

CodePudding user response:

Don't bother, u3d take solution


Public AudioClip m_shootClip;
Protected AudioSource m_audio;

In the start
M_audio=this. Audio;

The key
M_audio. PlayOneShot (m_shootClip);

Will not be covered

CodePudding user response:

The
reference 4 floor JWXKK reply:
don't bother, u3d take solution


Public AudioClip m_shootClip;
Protected AudioSource m_audio;

In the start
M_audio=this. Audio;

The key
M_audio. PlayOneShot (m_shootClip);

Won't cover


Well,
  • Related