帮助!我得到一个错误!
Assets / PlayerCollision.cs(12,36):错误CS0122: `GameManager.EndGame()'由于其保护级别而无法访问
这是我的碰撞检测代码:
using UnityEngine;
public class PlayerCollision : MonoBehaviour {
public PlayerMovement movement;
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Obsticle")
{
movement.enabled = false;
FindObjectOfType<GameManager>().EndGame();
}
}
}
GameManager类:
using UnityEngine;
public class GameManager : MonoBehaviour {
public void EndGame() {
Debug.Log("Game Over");
}
}