Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 标签不能正常工作_C#_Unity3d - Fatal编程技术网

C# 标签不能正常工作

C# 标签不能正常工作,c#,unity3d,C#,Unity3d,我有以下几点 GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + PlayerController.circleradious.ToString()); 但屏幕上只有无速度圈收音机: 即使我这样做了 GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + 100); 是一样的。我不明白我的错误是什么 所有代码: if (GUIEnable

我有以下几点

GUI.Label(new Rect(3, 60, 150, 20), "No-speed circle radious: " + PlayerController.circleradious.ToString());
但屏幕上只有
无速度圈收音机:

即使我这样做了

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), ...);


设定

GUIStyle.wordWrap = true;

您是否尝试过为该参数返回字符串的函数,例如string.Concat(“No speed circle radious:”,PlayerController.circleradious.ToString())或string.Format(“No speed circle radious:{0}”,PlayerController.circleradious.ToString())?看起来不错。坐标是否显示在屏幕上?或者它隐藏在背景的某个地方?更改坐标并重试。是否只有我认为150px太短而无法显示整个消息?问题是它太短了。
GUIStyle.wordWrap = true;