We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
audiokit里需求一个方法,只是设定音频,但不播放,后续用resume和pause控制播放 要实现一个开火功能,枪声是循环播放素材,开枪播放,熄火暂停.
private void Start() { // 激活事件时开火 // 取消激活事件时停火 // 初始化音效 _akmSound = AudioKit.PlaySound(Fxsound.AKM, true); _akmSound.Pause(); } private void Update() { if (!_isFire) { _akmSound.Pause(); } else { if (Time.time - _lastFireTime > fireInterval) { Debug.Log("Fire"); Fire(); _lastFireTime = Time.time; _akmSound.Resume(); } } }
这样写开始后声音还是会一开始就播放,因该是异步加载的问题
目前是这样实现的
private void Update() { if (!_isFire) { _akmSound?.Pause(); } else { if (Time.time - _lastFireTime > fireInterval) { if (_isFirstFire) { _isFirstFire = false; // 初始化音效 _akmSound = AudioKit.PlaySound(Fxsound.AKM, true); } Debug.Log("Fire"); Fire(); _lastFireTime = Time.time; _akmSound.Resume(); } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
audiokit里需求一个方法,只是设定音频,但不播放,后续用resume和pause控制播放
要实现一个开火功能,枪声是循环播放素材,开枪播放,熄火暂停.
这样写开始后声音还是会一开始就播放,因该是异步加载的问题
目前是这样实现的
The text was updated successfully, but these errors were encountered: