UnityAPI手册-2019.4官网版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
GUILayout.BeginArea
# [GUILayout](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUILayout.html).BeginArea public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, string **text**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, [Texture](https://docs.unity3d.com/cn/2019.4/ScriptReference/Texture.html) **image**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, [GUIContent](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIContent.html) **content**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, [GUIStyle](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIStyle.html) **style**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, string **text**, [GUIStyle](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIStyle.html) **style**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, [Texture](https://docs.unity3d.com/cn/2019.4/ScriptReference/Texture.html) **image**, [GUIStyle](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIStyle.html) **style**); public static void **BeginArea** ([Rect](https://docs.unity3d.com/cn/2019.4/ScriptReference/Rect.html) **screenRect**, [GUIContent](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIContent.html) **content**, [GUIStyle](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIStyle.html) **style**); ## 参数 | text | (可选)要在该区域中显示的文本。 | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | image | (可选)要在该区域中显示的纹理。 | | content | (可选)在该区域顶部显示的文本、图像和工具提示。 | | style | 要使用的样式。如果省略,则使用空 [GUIStyle](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIStyle.html) ([GUIStyle.none](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUIStyle-none.html)),提供透明背景。 | ## 描述 在一个固定的屏幕区域中开始 GUI 控件的 GUILayout 块。 默认情况下,使用 GUILayout 创建的任何 GUI 控件都放置在屏幕的左上角。 若要在任意区域放置一系列自动布局的控件,请使用 GUILayout.BeginArea 为自动布局系统定义要使用的新区域。 另请参阅:[EndArea](https://docs.unity3d.com/cn/2019.4/ScriptReference/GUILayout.EndArea.html)  \ *说明示例区域。* ``` using UnityEngine; public class ExampleScript : MonoBehaviour { void OnGUI() { // Starts an area to draw elements GUILayout.BeginArea(new Rect(10, 10, 100, 100)); GUILayout.Button("Click me"); GUILayout.Button("Or me"); GUILayout.EndArea(); } } ``` 在混合 GUILayout 代码时,该函数非常有用。它必须与 EndArea 调用配对使用。BeginArea/EndArea 不能嵌套。
da
2022年6月9日 23:41
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码