vault backup: 2023-08-03 16:53:02

This commit is contained in:
BlueRose 2023-08-03 16:53:02 +08:00
parent 9f611bf6da
commit aa88804f22

View File

@ -53,9 +53,8 @@ tsc xxx.ts
"@types/mocha": "^7.0.1" "@types/mocha": "^7.0.1"
} }
``` ```
5. 代码写在项目目录下的`Content/TypeScript`中。 4. 代码写在项目目录下的`TypeScript`中,之后就会在编辑器`Blueprints/TypeScript`目录下出现资产图标。
6. 之后就会在编辑器`Blueprints/TypeScript`目录下出现资产图标。 5. 加入ReactUMG。
7. 加入ReactUMG。
1. 进入 Content/javascript 目录 npm init 创建 package.json。 1. 进入 Content/javascript 目录 npm init 创建 package.json。
2. 创建成功后,向文件中粘贴如下内容 2. 创建成功后,向文件中粘贴如下内容
```json ```json
@ -66,10 +65,11 @@ tsc xxx.ts
``` ```
3. 然后 npm install 一次。 3. 然后 npm install 一次。
4. 打开工程根目录的 tsconfig.json 在 typeRoots 中 加入 "Plugins/ReactUMG/Typing"。 4. 打开工程根目录的 tsconfig.json 在 typeRoots 中 加入 "Plugins/ReactUMG/Typing"。
8. 打开 工程,在引擎中点击 ue.d.ts 。 6. 打开 工程,在引擎中点击 ue.d.ts 。
9. 在`ProjectSettings - Packaging - Additional Not-Asset Directories to Package`中添加`Content/javaScript` 7. 在`ProjectSettings - Packaging - Additional Not-Asset Directories to Package`中添加`Content/javaScript`
8. 在项目的Source下模块文件中添加`"JsEnv", "UMG", "Puerts"`,比如`PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "JsEnv", "UMG", "Puerts" });`
### Node环境设置 ### Node环境设置
目前最新版本的Puerts只需修改JsEnv模块文件`JsEnv.Build.cs`里的UseNodejs为true即可。
### 调试方法 ### 调试方法
具体可以参考: 具体可以参考:
- Puerts Inspector指南在UE4和Unity里调试Javascript:https://zhuanlan.zhihu.com/p/359598262 - Puerts Inspector指南在UE4和Unity里调试Javascript:https://zhuanlan.zhihu.com/p/359598262