EndGame()を追加すると、 ゲームが終了すると、サウンドの再生が停止します。 機能を削除すると、サウンドが正常に再生されます。 Gover.PlayをEndGameに追加しようとしましたが、それもうまくいきませんでした。 このバグは、なぜそれが起こっているのか私には意味をなさない。 エディタとライブデバイスの両方で発生します。機能が追加されたときにサウンドが機能しなくなる
ありがとうございます。ここで
は私のコードです:
Update() {
if (Input.GetMouseButtonDown(0))
{
}
else
{
AudioSource[] aSources = GetComponents<AudioSource>();
perfecthit = aSources [0]; // Works
gover = aSources [1]; // Works without EndGame()
miss = aSources [2]; // Works
gover.Play();
EndGame();// Adding this makes gover.Play stop working
}
}
private void EndGame()
{
Social.ReportScore (scoreCount, "--", (bool success) => {
//SUCCESS or FAIL
});
PlayerPrefs.SetInt("byte", PlayerPrefs.GetInt("byte") + scoreCount/2);
if (PlayerPrefs.GetInt ("score") < scoreCount)
PlayerPrefs.SetInt ("score", scoreCount);
gameOver = true;
endPanel.SetActive (true);
theStack[stackIndex].AddComponent<Rigidbody>();
stack.SetActive (false);
demoObj.SetActive (true);
}
これは、Android上であまりにもか、単にエディタで起こるんを使用してに見たいですか?コードの 'Social.ReportScore'行にコメントして、まだ起きているかどうか教えてください。 – Programmer
@Programmerまだ起こっています。それはエディタと私のライブデバイスにあります。 – Lynnstrum
プロジェクトを解凍してどこかで更新し、ここにリンクを提供できますか?私は見えない何かが起こっていると思います。すべてのグラフィックファイルと重要なファイルを削除することができます。 – Programmer