【发布时间】:2021-11-16 15:38:41
【问题描述】:
我正在统一制作一个播放器脚本来显示它的健康和能量等级。虽然我得到了所需的输出,但有人可以解释上述问题是什么。这是代码:-
int health = 100;
int power = 0;
string name = Console.Readline("Hey player!! please type in your name. (Kindly do not use your real name)");
public Player()
{
Debug.Log("health is " + health);
Debug.Log("power level is " + power);
Debug.Log("the name of the player is " + name);
}
功能在这里:-
Player Warrior = new Player();
真的是严重的事情,需要看看。我也尝试过以其他方式调用该函数,但这仅符合我的愿望。我试图在谷歌上找到一些东西,但找不到准确的答案
【问题讨论】:
-
这是整个代码吗?我的意思是这是在
public class Player { ... }里面吗?同样对于 Unity 特定的 .. 你不想拥有Console.ReadLine...