勝つか失った場合でもゲームは正常に再開します。プレイヤーは、いずれかのシーンからタイトル画面に戻ることができます。しかし、この問題は、ゲームを一時停止し、一時停止メニューから終了するときに発生します。そうすると、タイトル画面がロードされますが、音楽はなく、さらに移動する方法はありません。それは、何らかの理由で、クレジット(音楽なし)に移動してタイトル画面に戻ることができますが、それ以上のことはできません。順序は、タイトル画面、チュートリアル画面、レベル1です。何か関係があるかどうかはわかりませんが、表示される一時停止メニューは、スペースを押すと有効/無効になるキャンバスだけです。ここには一時停止スクリプトがあります。一時停止メニューから終了してタイトル画面から再開するC#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class pauseScript : MonoBehaviour {
private bool isPaused = true;
public GameObject pauseMenuCanvas;
public AudioSource audioSource;
public AudioClip Paused;
public AudioClip notPressingStart;
void Awake()
{
audioSource = GetComponent<AudioSource>();
}
void Update()
{
Sound();
Pausing();
}
void Pausing()
{
if (!isPaused && Input.GetKeyDown (KeyCode.Escape))
{
Application.LoadLevel ("titleScreen");
}
if (!isPaused) {
Time.timeScale = 0f;
pauseMenuCanvas.SetActive (true);
isPaused = false;
AudioListener.volume = 0f;
} else {
Time.timeScale = 1f;
pauseMenuCanvas.SetActive (false);
isPaused = true;
AudioListener.volume = 1f;
}
if (Input.GetKeyDown (KeyCode.Space)){
isPaused = !isPaused;
}
}
void Sound()
{
if (Input.GetKeyDown (KeyCode.Space))
audioSource.PlayOneShot (Paused, 7f);
}
}
これは今すぐうまくいきます。ありがとう! –