【发布时间】:2021-09-22 11:19:53
【问题描述】:
我正在尝试将变量从我的游戏管理器脚本传递到我的播放器控制器脚本。使用以下代码,我收到错误消息“playerIsAlive 在当前上下文中不存在”。
游戏管理器脚本:
playerControllerScript = GameObject.Find("Player").GetComponent<PlayerController>();
void Update()
{
if(playerIsAlive == false)
{
StartCoroutine(PlayerRespawn);
}
}
播放器控制器脚本:
public bool playerIsAlive;
else if(collision.gameObject.CompareTag("Enemy"))
{
playerIsAlive = false;
Destroy(gameObject);
}
【问题讨论】:
-
playerControllerScript.playerIsAlive?
标签: c# unity3d spawn ienumerator