You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
55 lines
2.6 KiB
Plaintext
55 lines
2.6 KiB
Plaintext
Availability:Public
|
||
Title: 在项目中使用Slate
|
||
Crumbs:%ROOT%, Programming, Programming/Slate
|
||
Description:设置您的项目来使用Slate用户界面架构
|
||
|
||
## 概述
|
||
|
||
[EXCERPT:main]
|
||
为了使用Slate用户界面架构,您的项目必须进行适当的设置,以便它可以意识到该
|
||
架构。这允许您包含 `Slate.h` 头文件及引用使用Slate构建用户界面
|
||
所需的各种架构元素。
|
||
|
||
## 模块依赖
|
||
|
||
Slate架构存储在几个模块中。为了使您的项目意识到这些模块的存在,
|
||
则必须在 *.build.cs 文件中为您的项目设置一些依赖项。
|
||
|
||
您的项目需要访问的模块是:
|
||
|
||
| 模块| 依赖类型 |
|
||
| --------- | --------------- |
|
||
| InputCore | 公有|
|
||
| Slate | 私有|
|
||
| SlateCore | 私有|
|
||
|
||
**要想设置Slate模块的依赖项:**
|
||
|
||
1. 打开您的项目的 `[ProjectName].build.cs` 文件。它位于 `[ProjectDir]/[ProjectName]/Source/[ProjectName]` 目录中。
|
||
1. 通过将 `"InputCore"` 添加到 `PublicDependencyModuleNames` 中,来添加InputCore公有依赖。
|
||
|
||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||
|
||
[REGION:note]
|
||
当创建代码项目时,InputCore默认设置为公有依赖。
|
||
[/REGION]
|
||
|
||
1. 添加Slate和SlateCore私有依赖。*.build.cs文件中有一行代码用于添加私有依赖:
|
||
|
||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||
|
||
您所需要做的就是将SlateCore和Slate模块添加到那行代码中:
|
||
|
||
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||
|
||
[REGION:tip]
|
||
根据您创建项目的时机及其引擎版本的不同,它可能已经在
|
||
*.build.cs文件中设置了依赖项,但是注释掉了。您可以简单地取消注释适当的代码行来
|
||
设置依赖!
|
||
|
||
// Uncomment if you are using Slate UI
|
||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||
|
||
[/REGION]
|
||
[/EXCERPT:main]
|