212 lines
		
	
	
		
			8.9 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			212 lines
		
	
	
		
			8.9 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						||
title: IOS&Android Package
 | 
						||
date: 2023-05-05 10:59:01
 | 
						||
excerpt: 
 | 
						||
tags: MAC IOS Android
 | 
						||
rating: ⭐⭐
 | 
						||
---
 | 
						||
# 其他笔记
 | 
						||
[[黑苹果配置笔记]]
 | 
						||
[[安装Mac UE开发环境]]
 | 
						||
[[安装UE开发环境]]
 | 
						||
 | 
						||
## 其他问题
 | 
						||
- shadercompileworker terminated unexpectedly falling back to directly compiling which will be very slow.
 | 
						||
	- 编译DDC阶段出现 SCW 5 Queued Jobs, Unknown number of processed jobs!:在 Nvidia 控制面板的“管理 3D 设置”中将着色器缓存大小设置为“无限制”。
 | 
						||
		- *没有效果*
 | 
						||
	- 设置注册表,来调整**TdrDelay**和**TdrDdiDelay**都更改为更高的值(例如 60 秒)。
 | 
						||
		- Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers
 | 
						||
		- 将**TdrDelay**设置为**2s**,将**TdrDdiDelay**设置为**5s** ;或者将其删除。
 | 
						||
		- 参考
 | 
						||
			- [https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys ](https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys) 
 | 
						||
			- https://helpx.adobe.com/substance-3d-painter/technical-support/technical-issues/gpu-issues/gpu-drivers-crash-with-long-computations-tdr-crash.html
 | 
						||
			- https://learn.microsoft.com/en-us/answers/questions/1163496/code-error-when-building-unreal-engine-5-source-co
 | 
						||
			- https://www.reddit.com/r/battlefield_4/comments/1xzzn4/tdrdelay_10_fixed_my_crashes_since_last_patch/
 | 
						||
# 设置版本号
 | 
						||
修改三處:
 | 
						||
1. `Engine\Source\Runtime\Launch\Resources\version.h`尋找BUILT_FROM_CHANGELIST並修改
 | 
						||
2. 更新`Engine\Build\Build.Version`
 | 
						||
3. `Engine\Intermediate\ProjectFiles\UE4.vcxproj中的BRANCH_NAME`
 | 
						||
 | 
						||
# 将CMD的代码页设置成UTF-8
 | 
						||
```c++
 | 
						||
chcp 65001
 | 
						||
```
 | 
						||
# 命令行
 | 
						||
完全构建
 | 
						||
```c++
 | 
						||
-set:WithClean=true
 | 
						||
```
 | 
						||
 | 
						||
## Win
 | 
						||
```bash
 | 
						||
cd /d E:/
 | 
						||
cd E:/UnrealEngine/UnrealEngine5-Toon/Engine/Build/BatchFiles
 | 
						||
RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:SignExecutables=false -set:EmbedSrcSrvInfo=false -set:GameConfigurations=Development;Shipping -set:WithFullDebugInfo=false -set:HostPlatformEditorOnly=false -set:AnalyticsTypeOverride= -set:HostPlatformDDCOnly=true -set:WithWin64=true -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithLinuxArm64=false -set:CompileDatasmithPlugins=false -set:WithServer=false -set:WithClient=false
 | 
						||
```
 | 
						||
 | 
						||
```
 | 
						||
del *.cpp /s
 | 
						||
```
 | 
						||
 | 
						||
## Android
 | 
						||
```bash
 | 
						||
cd /d D:/
 | 
						||
cd D:/UnrealEngine/UnrealEngine5/Engine/Build/BatchFiles
 | 
						||
 | 
						||
RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:SignExecutables=false -set:EmbedSrcSrvInfo=false -set:GameConfigurations=Development;Shipping -set:WithFullDebugInfo=false -set:HostPlatformEditorOnly=false -set:AnalyticsTypeOverride= -set:HostPlatformDDCOnly=false -set:WithWin64=true -set:WithMac=false -set:WithAndroid=true -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithLinuxArm64=false -set:CompileDatasmithPlugins=false -set:WithServer=false -set:WithClient=false
 | 
						||
```
 | 
						||
 | 
						||
```
 | 
						||
RunUAT Turnkey -command=Verifysdk -platform=Android
 | 
						||
```
 | 
						||
 | 
						||
## MAC
 | 
						||
```bash
 | 
						||
cd ./Desktop/UnrealEngine/Engine/Build/BatchFiles
 | 
						||
./RunUAT.sh BuildGraph -target="Make Installed Build MAC" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:SignExecutables=false -set:EmbedSrcSrvInfo=false -set:GameConfigurations=Development;Shipping -set:WithFullDebugInfo=false -set:HostPlatformEditorOnly=true -set:AnalyticsTypeOverride= -set:HostPlatformDDCOnly=false -set:WithWin64=false -set:WithMac=true -set:WithAndroid=false -set:WithIOS=true -set:WithTVOS=false -set:WithLinux=false -set:WithLinuxArm64=false -set:CompileDatasmithPlugins=false -set:WithServer=false -set:WithClient=false
 | 
						||
```
 | 
						||
 | 
						||
# MAC&IOS
 | 
						||
## Windows
 | 
						||
安装环境:
 | 
						||
- iTunes 12.10.11.2:不安装,IOS SDK就无法检测到。
 | 
						||
 | 
						||
文档:
 | 
						||
-  Building for iOS on Windows:[https://docs.unrealengine.com/5.1/en-US/building-ios-projects-on-windows-in-unreal-engine/](https://docs.unrealengine.com/5.1/en-US/building-ios-projects-on-windows-in-unreal-engine/)
 | 
						||
-  Provisioning Profiles and Signing Certificates:[https://docs.unrealengine.com/5.1/en-US/setting-up-ios-tvos-and-ipados-provisioning-profiles-and-signing-certificates-for-unreal-engine-projects/](https://docs.unrealengine.com/5.1/en-US/setting-up-ios-tvos-and-ipados-provisioning-profiles-and-signing-certificates-for-unreal-engine-projects/)
 | 
						||
 | 
						||
### GenerateProjectFiles跳过SDK问题
 | 
						||
运行GenerateProjectFiles.bat时,提示:
 | 
						||
>Some Platforms were skipped due to invalid SDK setup: Mac, IOS, Android, Linux, LinuxArm64, TVOS.
 | 
						||
 | 
						||
查看`Engine\Programs\UnrealBuildTool`目录下的`Log_GPF.txt`
 | 
						||
```
 | 
						||
Note: Android toolchain NDK r25b recommended
 | 
						||
        Registering build platform: Android - buildable: False
 | 
						||
    Registering build platform: UnrealBuildTool.IOSPlatformFactory
 | 
						||
        Registering build platform: IOS - buildable: False
 | 
						||
    Registering build platform: UnrealBuildTool.LinuxPlatformFactory
 | 
						||
        Registering build platform: Linux - buildable: False
 | 
						||
        Registering build platform: LinuxArm64 - buildable: False
 | 
						||
    Registering build platform: UnrealBuildTool.MacPlatformFactory
 | 
						||
        Registering build platform: Mac - buildable: False
 | 
						||
    Registering build platform: UnrealBuildTool.TVOSPlatformFactory
 | 
						||
        Registering build platform: TVOS - buildable: False
 | 
						||
    Registering build platform: UnrealBuildTool.WindowsPlatformFactory
 | 
						||
Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (1)
 | 
						||
Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (2)
 | 
						||
```
 | 
						||
 | 
						||
- 问题原因
 | 
						||
	- 安装Itunes太新或者没有安装itunes。
 | 
						||
- 解决方法
 | 
						||
	- 卸载**itunes**以及**Apple Mobile Device Support**。之后安装12.10.11.2版本的**itunes**。
 | 
						||
 | 
						||
### SSH登录设置
 | 
						||
MAC
 | 
						||
Apple
 | 
						||
 | 
						||
ssh bluerose@192.168.2.164
 | 
						||
ECDSA key fingerprint is SHA256:fkRVqfbPPmbLUB4dn3QRFpATQykuu1AtlWmNLMSDXtU.
 | 
						||
 | 
						||
SSH还需要生成秘钥文件之后放置在对应文件夹里
 | 
						||
 | 
						||
### 证书与BaseEngine.ini
 | 
						||
证书需要后缀名为p12的证书,可以通过MAC的钥匙串进行转换。具体操作为:
 | 
						||
1. 选择想要导出的证书,右键点击导出。 
 | 
						||
2. 选择p12类型
 | 
						||
3. 不要设置密码。 
 | 
						||
 | 
						||
可以参考:https://blog.51cto.com/u_15318120/3241489
 | 
						||
>. cer证书只包含公钥,p12证书可能同时包含公钥和私钥。这就是他们的区别,除了xcode开发工具,打包都需要p12。
 | 
						||
 | 
						||
需要通过编辑器先在`Platform-IOS`先导入一次证书,通过后再把DefaultEngine.ini中的IOS设置加入到BaseEngine.ini中。
 | 
						||
 | 
						||
比如:
 | 
						||
DefaultEngine.ini
 | 
						||
```ini
 | 
						||
[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
 | 
						||
BundleDisplayName=eto
 | 
						||
BundleName=eto
 | 
						||
BundleIdentifier=cn.tectree.eto
 | 
						||
MobileProvision=eto.mobileprovision
 | 
						||
SigningCertificate=iPhone Developer: xiangtian luo (RD2564LPA4)
 | 
						||
```
 | 
						||
 | 
						||
BaseEngine.ini
 | 
						||
```ini
 | 
						||
[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
 | 
						||
BundleDisplayName=etoBundleName=eto
 | 
						||
BundleIdentifier=cn.tectree.eto
 | 
						||
MobileProvision=eto.mobileprovision
 | 
						||
SigningCertificate=iPhone Developer: xiangtian luo (RD2564LPA4)
 | 
						||
```
 | 
						||
 | 
						||
### 证书放置位置
 | 
						||
 `~/Library/MobileDevice/Provisioning/Profiles`
 | 
						||
 | 
						||
## MAC
 | 
						||
![[安装Mac UE开发环境]]
 | 
						||
 | 
						||
## MAC 删除CPP文件
 | 
						||
 | 
						||
```bash
 | 
						||
cd /Users/Shared/UE_Toon/localBuilds/Engine/Mac/Engine/Source
 | 
						||
find . -name "*.txt" | xargs rm -rf
 | 
						||
```
 | 
						||
 | 
						||
## MAC使用7zip进行压缩
 | 
						||
安装p7zip
 | 
						||
```bash
 | 
						||
brew update
 | 
						||
brew install p7zip
 | 
						||
```
 | 
						||
压缩
 | 
						||
```bash
 | 
						||
cd /Users/Shared/UE_Toon/LocalBuilds/Engine/
 | 
						||
7z a UnrealEngine5.1.1-Toon-IOS-2023.7.14.7z ./Mac/* -r -mx=9
 | 
						||
```
 | 
						||
- a:表示add命令,即新建一个压缩文件,该压缩文件存放在当前目录下
 | 
						||
- -r:表示遍历所有的子目录,每个文件都执行压缩操作,添加到压缩文件中。
 | 
						||
- -mx:表示压缩等级,9级是最高等级。默认等级是5。
 | 
						||
 | 
						||
分卷压缩
 | 
						||
```bash
 | 
						||
cd /Users/Shared/UE_Toon/LocalBuilds/Engine/
 | 
						||
7z a UnrealEngine5.1.1-Toon-IOS-2023.7.14.7z ./Mac/* -r -mx=9 -v4000m
 | 
						||
```
 | 
						||
 | 
						||
# Android
 | 
						||
UE5.1为准的安装环境:
 | 
						||
- Android Studio 4.0
 | 
						||
- Android Cmd line tool 8.0
 | 
						||
- Android NDK r25b
 | 
						||
- Android SDK
 | 
						||
	- Recommended: SDK 32
 | 
						||
	- Minimum for compiling UE: SDK 30
 | 
						||
 | 
						||
具体步骤参考:https://docs.unrealengine.com/5.1/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/
 | 
						||
因为打包Android时一定会运行**Extra/SetupAndroid.bat**,所以需要完全按照文档步骤进行操作,比如:
 | 
						||
- 使用Android Studio4.0
 | 
						||
- 使用默认的安装位置。
 | 
						||
 | 
						||
设置完之后需要运行`GenerateProjectFiles.bat`并且编译一下。
 | 
						||
 | 
						||
 | 
						||
# 插件构建
 | 
						||
```bash
 | 
						||
cd D:\UnrealEngine\UE_5.3\Engine\Build\Batchfiles
 | 
						||
RunUAT.bat BuildPlugin -plugin="D:\Work\MultiDraw\Plugins\MultiDraw\MultiDraw.uplugin" -package="D:\MultiDraw"
 | 
						||
```
 | 
						||
 | 
						||
# BuildGraph PlatformFilters
 | 
						||
在InstalledEngineFilters.xml可以看得出各个平台的区别
 | 
						||
```xml
 | 
						||
    <!-- Platform extensions filter overrides -->
 | 
						||
    <Expand Name="Platform_FilterOverrides"/>
 | 
						||
    
 | 
						||
    <ForEach Name="Filter" Values="$(CopyEditorEngineOrPlatformFilter)">
 | 
						||
        <Property Name="CopyEditorFilter" Value="$(CopyEditorFilter);Engine/$(Filter);Engine/Platforms/*/$(Filter)"/>
 | 
						||
    </ForEach>
 | 
						||
``` |