Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/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
Unity3d 如何统一使用吉他织物_Unity3d - Fatal编程技术网

Unity3d 如何统一使用吉他织物

Unity3d 如何统一使用吉他织物,unity3d,Unity3d,我是unity的新手。我在脚本中见过GuitTexture,但不知道如何使用它。我想知道我可以用GuitTexture做什么,以及如何在屏幕上显示GuitTexture。请帮助我。GUI(图形用户界面)纹理是可以在屏幕上显示的图像,就像在相机上添加一层。我的意思是,如果你在屏幕上放置一个GUI纹理,不管玩家去哪里,它总是出现在相对于玩家相机的相同位置。使用GUI纹理的一个很好的例子是,如果您想制作一个始终显示在玩家视图角落的健康栏。 如何使用GUI纹理: public class TestGUI

我是unity的新手。我在脚本中见过GuitTexture,但不知道如何使用它。我想知道我可以用GuitTexture做什么,以及如何在屏幕上显示GuitTexture。请帮助我。

GUI(图形用户界面)纹理是可以在屏幕上显示的图像,就像在相机上添加一层。我的意思是,如果你在屏幕上放置一个GUI纹理,不管玩家去哪里,它总是出现在相对于玩家相机的相同位置。使用GUI纹理的一个很好的例子是,如果您想制作一个始终显示在玩家视图角落的健康栏。

如何使用GUI纹理:

public class TestGUI {
     //declare a texture, you can do this multiple ways
     public Texture textureType1;
     //this type is usually more blurry because it is being rendered as a texture rather than a plain image
     public 2DTexture textureTyple2;
     //this type is less blurry than Texture, and is used for 2D elements
     public GUITexture textureType3;
     //this type is the clearest and is meant solely for GUI

     public void OnGUI()
     {
          GUI.DrawTexture(new Rect(xOffset, yOffset, width, height), textureType3);
          //This texture is drawn but will not necessarily fill the rectangle you declared
          GUI.DrawTexture(new Rect(xOffset, yOffset, width, height), textureType3, ScaleMode.ScaleToFit, true, 1.0f);
          //this texture is drawn and will be scaled to fill the dimensions of the rectangle you declared with a fill aspect ratio of 1.
          //this is good for things like health bars since it doesnt matter if the image is stretched since it will most likely only be a color
     }
}

警告:GuitTexture和OnGUI()是旧API的一部分,不推荐使用。请注意,许多UI教程现在已经过时。看看上面的新UI系统,让我来看看,我最好的猜测是Unity 5现在希望您将所有内容都包含在画布中。