GUI.Label无法正常工作
本文关键字:工作 常工作 Label GUI | 更新日期: 2023-09-27 18:00:48
我有以下
GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + PlayerController.circleradious.ToString());
但屏幕上只有CCD_ 1
即使我做
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
工作得很好。
您的rect可能太小,请尝试以下操作:
GUI.Label(new Rect(3, 60, 500, 20), ...);
或
GUI.Label(new Rect(3, 60, 150, 200), ...);
并设置
GUIStyle.wordWrap = true;