-1
我有一个类(的上电),其中我有一个布尔马格其公开宣称取一个类的布尔值从另一个类在统一
当我试图从另一个类(结果)访问布尔
// class Result
if(PowerUP.Mag)// need to return the bool value from class PowerUp
{
// code to run if powerup.mag is true
CoinCollectedCounter ++;
CoinCounterText.text = ""+CoinCollectedCounter;
col.gameObject.SetActive(false);
}
我没有得到布尔value..actually返回null
静态变量在游戏执行过程中保留一个值。而是通过'GetComponent()'获取脚本实例,并使用此实例访问该值。 –