RetryGame.cs
using System.Collections;
using System.Collections.Generic;
using UnityEditor.SceneManagement;
using UnityEngine;
public class RetryGame : MonoBehaviour {
public void OnMouseDown()
{
Debug.Log("Game Restart!");
//SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
EditorSceneManager.LoadScene("shot");
}
}
难道和下面这个冲突吗?
GameManager.cs
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log("hit");
if (isGameOver == true) return;
currentPin.Shooting();
SpawnPin();
score++;
scoreText.text = score.ToString();
}
}
你这个监听的都不是这个方法,当然就不执行了,Log也不会输出
你这button里面添加的监听OnMouseUpAsButton我并没有在retrygame脚本里面看到啊。