0
我有以下GUI.Label不能正常工作
GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + PlayerController.circleradious.ToString());
但只有No-speed circle radious:
是屏幕
上,即使我做
GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + 100);
是一樣的。我不明白我的錯誤是什麼。
所有代碼:
if (GUIEnabled)
{
GUI.Box(new Rect(0, 0, 550, 150), "Movement type : " + movementlabel);
GUI.Label(new Rect(3, 20, 150, 20), "Speed Factor: " + PlayerController.speedFactor.ToString());
PlayerController.speedFactor = GUI.HorizontalSlider(new Rect(160, 25, 350, 20), PlayerController.speedFactor, 0.0F, 100F);
GUI.Label(new Rect(3, 40, 150, 20), "Velocity: " + (player.rigidbody.velocity.magnitude).ToString());
if((PlayerController.movement == PlayerController.MoveType.KinectMovement)|| (PlayerController.movement == PlayerController.MoveType.KeyboardMovement)){
GUI.Label(new Rect(3, 60, 150, 20), "Rotation Factor: " + PlayerController.rotationFactor.ToString());
PlayerController.rotationFactor = GUI.HorizontalSlider(new Rect(160, 65, 350, 20), PlayerController.rotationFactor, 0.0F, 1000F);
GUI.Label(new Rect(3, 80, 150, 20), "Angular Velocity: " + (player.rigidbody.angularVelocity.magnitude).ToString());
}
else if (PlayerController.movement == PlayerController.MoveType.CenterPointKinectWithoutHands) {
GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + PlayerController.circleradious.ToString());
print(PlayerController.circleradious);
//PlayerController.circleradious = GUI.HorizontalSlider(new Rect(160, 65, 350, 20), PlayerController.circleradious, 0.0F, 20F);
}
GUI.Label(new Rect(3, 100, 150, 20), "Camera distance: " + mainCamera.transform.position.y);
mainCamera.transform.position = new Vector3(mainCamera.transform.position.x, GUI.HorizontalSlider(new Rect(160, 105, 350, 20), mainCamera.transform.position.y, 0.0F, 100F), mainCamera.transform.position.z);
}
其他GUI.Label
工作完美。
你有沒有試過,返回功能該參數的字符串,例如string.Concat(「No-speed circle radious:」,PlayerController.circleradious.ToString())or string.Format(「No-speed circle radious:{0}」,PlayerController.circleradious.ToString())? – barrick
看起來很好。座標是否顯示在屏幕上?或者它隱藏在某個地方的背景中?更改座標並重試。 – Raptor
我是唯一一個認爲150px太短而無法顯示整個信息的人? –