Unreal Engine开发:动作组件开发allv1

动作组件开发概述

在Unreal Engine中,动作组件(Action Components)是实现角色和物体动作的关键部分。通过动作组件,开发者可以方便地管理和控制角色的各种动作,如移动、跳跃、攻击、防御等。动作组件通常包含了一系列的动作状态和状态机,用于管理和切换这些状态。在本节中,我们将详细介绍如何在Unreal Engine中创建和管理动作组件,包括动作状态的设计、状态机的实现以及动作的触发和切换。

动作状态设计

动作状态是动作组件的核心组成部分,每个动作状态代表角色或物体在某一段时间内的一种特定行为。例如,角色可能有“站立”、“行走”、“奔跑”、“跳跃”、“攻击”等多个状态。每个状态都可以包含一系列的动作和动画,以及进入和退出该状态的条件。

动作状态的定义

在Unreal Engine中,动作状态通常通过一个枚举类型来定义。例如,我们可以定义一个名为ECharacterActionState的枚举类型,用于表示角色的各种动作状态:


// ECharacterActionState.h

#pragma 
LogUObjectHash: Compacting FUObjectHashTables data took 1.41ms LogTurnkeySupport: Project requires temp target (已启用VaRestX插件) LogLauncherProfile: Unable to use promoted target - D:/meikuang5.4/Binaries/Win64/UnrealGame.target does not exist. LogMonitoredProcess: Running Serialized UAT: [ cmd.exe /c ""E:/UE_5.4/Engine/Build/BatchFiles/RunUAT.bat" -ScriptsForProject="D:/meikuang5.4/煤矿变电站.uproject" Turnkey -command=VerifySdk -platform=Win64 -UpdateIfNeeded -EditorIO -EditorIOPort=61928 -project="D:/meikuang5.4/煤矿变电站.uproject" BuildCookRun -nop4 -utf8output -nocompileeditor -skipbuildeditor -cook -project="D:/meikuang5.4/煤矿变电站.uproject" -unrealexe="E:\UE_5.4\Engine\Binaries\Win64\UnrealEditor-Cmd.exe" -platform=Win64 -installed -stage -archive -package -build -clean -pak -iostore -compressed -archivedirectory="D:/meikuangdabao" -c lientconfig=Development" -nocompile -nocompileuat ] UATHelper: 打包 (Windows): Running AutomationTool... UATHelper: 打包 (Windows): Using bundled DotNet SDK version: 6.0.302 UATHelper: 打包 (Windows): Starting AutomationTool... UATHelper: 打包 (Windows): Parsing command line: -ScriptsForProject=D:/meikuang5.4/ú?????.uproject Turnkey -command=VerifySdk -platform=Win64 -UpdateIfNeeded -EditorIO -EditorIOPort=61928 -project=D:/meikuang5.4/ú?????.uproject BuildCookRun -nop4 -utf8output -nocompileeditor -skipbuildeditor -cook -project=D:/meikuang5.4/ú?????.uproject -unrealexe=E:\UE_5.4\Engine\Binaries\Win64\UnrealEditor-Cmd.exe -platform=Win64 -installed -stage -archive -package -build -clean -pak -iostore -compressed -archivedirectory=D:/meikuangdabao -clientconfig=Development -nocompile -nocompileuat UATHelper: 打包 (Windows): Initializing script modules... UATHelper: 打包 (Windows): Total script module initialization time: 0.18 s. UATHelper: 打包 (Windows): Using C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe UATHelper: 打包 (Windows): Executing commands... UATHelper: 打包 (Windows): Installed Sdk validity: UATHelper: 打包 (Windows): Win64: (Status=Valid, MinAllowed_Sdk=10.0.18362.0, MaxAllowed_Sdk=10.9.99999.0, Current_Sdk=10.0.26100.0, Allowed_AutoSdk=10.0.19041.0, Current_AutoSdk=, Flags="InstalledSdk_ValidVersionExists") UATHelper: 打包 (Windows): Scanning for envvar changes... UATHelper: 打包 (Windows): ... done! UATHelper: 打包 (Windows): Cleaning Temp Paths... UATHelper: 打包 (Windows): BUILD SUCCESSFUL UATHelper: 打包 (Windows): Setting up ProjectParams for D:\meikuang5.4\煤矿变电站.uproject UATHelper: 打包 (Windows): ********** BUILD COMMAND STARTED ********** UATHelper: 打包 (Windows): Running: E:\UE_5.4\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\dotnet.exe "E:\UE_5.4\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" 煤矿变电站 Win64 Development -Project="D:\meikuang5.4\煤矿变电站.uproject" -Clean -NoHotReload "D:\meikuang5.4\煤矿变电站.uproject" -NoUBTMakefiles -remoteini="D:\meikuang5.4" -skipdeploy -log="C:\Users\PC\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_5.4\UBA-煤矿变电站-Win64-Development.txt" UATHelper: 打包 (Windows): Log file: C:\Users\PC\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_5.4\UBA-ú����վ-Win64-Development.txt UATHelper: 打包 (Windows): Cleaning ú����վ binaries... UATHelper: 打包 (Windows): Compiled assembly file 'C:\Users\PC\AppData\Local\UnrealEngine\Intermediate\Build\BuildRules\MarketplaceRules.dll' appears to be for a newer CLR version or is otherwise invalid. Unreal Build Tool will try to recompile this assembly now. (Exception: Could not load file or assembly 'C:\Users\PC\AppData\Local\UnrealEngine\Intermediate\Build\BuildRules\MarketplaceRules.dll'. Format of the executable (.exe) or library (.dll) is invalid.) UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRestEditor\VaRestEditor.Build.cs(5,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'VaRestEditor' UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRest\VaRest.Build.cs(7,15): error CS0101: The namespace 'UnrealBuildTool.Rules' already contains a definition for 'VaRest' UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRestEditor\VaRestEditor.Build.cs(7,9): error CS0111: Type 'VaRestEditor' already defines a member called 'VaRestEditor' with the same parameter types UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRest\VaRest.Build.cs(9,10): error CS0111: Type 'VaRest' already defines a member called 'VaRest' with the same parameter types UATHelper: 打包 (Windows): Available x64 toolchains (1): UATHelper: 打包 (Windows): * C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207 UATHelper: 打包 (Windows): (Family=14.44.35207, FamilyRank=5, Version=14.44.35219, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64) UATHelper: 打包 (Windows): Unavailable x64 toolchains (1): UATHelper: 打包 (Windows): * C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133 UATHelper: 打包 (Windows): (Family=14.29.30133, FamilyRank=5, Version=14.29.30159, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error="UnrealBuildTool requires at minimum the MSVC 14.34.31933 toolchain. Please install a later toolchain such as 14.38.33130 from the Visual Studio installer.") UATHelper: 打包 (Windows): Visual Studio 2022 compiler version 14.44.35219 is not a preferred version. Please use the latest preferred version 14.38.33130 UATHelper: 打包 (Windows): Took 2.26s to run dotnet.exe, ExitCode=0 UATHelper: 打包 (Windows): Running: E:\UE_5.4\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\dotnet.exe "E:\UE_5.4\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" 煤矿变电站 Win64 Development -Project=D:\meikuang5.4\煤矿变电站.uproject -Manifest=D:\meikuang5.4\Intermediate\Build\Manifest.xml -remoteini="D:\meikuang5.4" -skipdeploy -log="C:\Users\PC\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_5.4\UBA-煤矿变电站-Win64-Development_2.txt" UATHelper: 打包 (Windows): Log file: C:\Users\PC\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_5.4\UBA-ú����վ-Win64-Development_2.txt UATHelper: 打包 (Windows): Creating makefile for ú����վ (no existing makefile) UATHelper: 打包 (Windows): Compiled assembly file 'C:\Users\PC\AppData\Local\UnrealEngine\Intermediate\Build\BuildRules\MarketplaceRules.dll' appears to be for a newer CLR version or is otherwise invalid. Unreal Build Tool will try to recompile this assembly now. (Exception: Could not load file or assembly 'C:\Users\PC\AppData\Local\UnrealEngine\Intermediate\Build\BuildRules\MarketplaceRules.dll'. Format of the executable (.exe) or library (.dll) is invalid.) UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRestEditor\VaRestEditor.Build.cs(5,14): error CS0101: The namespace '<global namespace>' already contains a definition for 'VaRestEditor' UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRest\VaRest.Build.cs(7,15): error CS0101: The namespace 'UnrealBuildTool.Rules' already contains a definition for 'VaRest' UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRestEditor\VaRestEditor.Build.cs(7,9): error CS0111: Type 'VaRestEditor' already defines a member called 'VaRestEditor' with the same parameter types UATHelper: 打包 (Windows): E:\UE_5.4\Engine\Plugins\Marketplace\VaRestX7f7cce2dc228V1\Source\VaRest\VaRest.Build.cs(9,10): error CS0111: Type 'VaRest' already defines a member called 'VaRest' with the same parameter types UATHelper: 打包 (Windows): Available x64 toolchains (1): UATHelper: 打包 (Windows): * C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207 UATHelper: 打包 (Windows): (Family=14.44.35207, FamilyRank=5, Version=14.44.35219, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64) UATHelper: 打包 (Windows): Unavailable x64 toolchains (1): UATHelper: 打包 (Windows): * C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133 UATHelper: 打包 (Windows): (Family=14.29.30133, FamilyRank=5, Version=14.29.30159, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error="UnrealBuildTool requires at minimum the MSVC 14.34.31933 toolchain. Please install a later toolchain such as 14.38.33130 from the Visual Studio installer.") UATHelper: 打包 (Windows): Visual Studio 2022 compiler version 14.44.35219 is not a preferred version. Please use the latest preferred version 14.38.33130 UATHelper: 打包 (Windows): Available x64 toolchains (1): UATHelper: 打包 (Windows): * C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207 UATHelper: 打包 (Windows): (Family=14.44.35207, FamilyRank=5, Version=14.44.35219, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64) UATHelper: 打包 (Windows): Unavailable x64 toolchains (1): UATHelper: 打包 (Windows): * C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133 UATHelper: 打包 (Windows): (Family=14.29.30133, FamilyRank=5, Version=14.29.30159, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error="UnrealBuildTool requires at minimum the MSVC 14.34.31933 toolchain. Please install a later toolchain such as 14.38.33130 from the Visual Studio installer.") UATHelper: 打包 (Windows): Visual Studio 2022 compiler version 14.44.35219 is not a preferred version. Please use the latest preferred version 14.38.33130 UATHelper: 打包 (Windows): Total execution time: 2.35 seconds UATHelper: 打包 (Windows): Expecting to find a type to be declared in a module rules named 'VaRest' in 'Unknown Assembly'. This type must derive from the 'ModuleRules' type defined by UnrealBuildTool. UATHelper: 打包 (Windows): Took 2.46s to run dotnet.exe, ExitCode=8 UATHelper: 打包 (Windows): UnrealBuildTool failed. See log for more details. (C:\Users\PC\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_5.4\UBA-煤矿变电站-Win64-Development_2.txt) UATHelper: 打包 (Windows): AutomationTool executed for 0h 0m 7s UATHelper: 打包 (Windows): AutomationTool exiting with ExitCode=8 (8) UATHelper: 打包 (Windows): BUILD FAILED PackagingResults: Error: Unknown Error
最新发布
10-24
<think>我们正在处理用户关于Unreal Engine 5.4打包项目(包含VaRestX插件)时遇到的三个主要问题: 1. MarketplaceRules.dll文件无效 2. VaRestEditor和VaRest命名冲突 3. Visual Studio编译器版本非首选 根据引用[1]可知版本控制的重要性,但当前问题更侧重于打包过程中的错误处理。引用[2]提到Unreal Engine 5的兼容性和模块重命名,这提示我们可能需要注意插件的兼容性和命名规范。引用[3]提到了打包时出现的错误,其中提到了Name'Dev-Core'的错误,这类似于用户提到的命名冲突问题。引用[4]是关于LibHv集成的经验,可能不直接相关,但可以借鉴其中解决问题的思路。 由于VaRestX插件是第三方插件,我们需要确保其与UE5.4的兼容性。另外,命名冲突问题可能与模块重命名有关(如引用[2]中提到的模块重名问题),而VS编译器版本问题则需要我们检查并设置正确的编译器版本。 以下是针对每个问题的解决方案思路: 1. **MarketplaceRules.dll文件无效**: - 这个dll文件通常与Unreal Engine的商城规则验证有关。可能是由于插件没有正确打包或者插件本身的问题。 - 尝试重新生成项目文件:删除Intermediate、Saved、Binaries文件夹以及.sln文件,然后重新生成项目(右击.uproject文件,选择“Generate Visual Studio project files”)。 - 确保插件是从官方渠道获取并且与UE5.4兼容。如果插件是从市场下载的,检查是否有更新版本支持UE5.4。 2. **VaRestEditor和VaRest命名冲突**: - 引用[2]提到了模块重命名以避免冲突,因此我们可能需要修改插件的模块名称。 - 检查插件文件夹内的.Build.cs文件(例如VaRest.Build.cs和VaRestEditor.Build.cs),确保两个模块的命名没有冲突。通常,编辑器模块应该命名为“YourModuleEditor”,运行时模块命名为“YourModule”。 - 如果插件自身的模块命名冲突,可以考虑修改插件的模块名(需要修改.Build.cs文件以及对应的.uplugin文件中的"Modules"部分),但这可能会影响插件源代码,因此需要谨慎操作。此外,可以查看插件的文档或联系开发者获取支持。 3. **Visual Studio编译器版本非首选**: - 确保安装了Unreal Engine 5.4推荐的Visual Studio版本(通常是VS2022,因为UE5需要C++20支持)。 - 在Visual Studio Installer中确认已安装必要的组件,包括“使用C++的桌面开发”和Windows SDK(版本需符合UE5.4要求)。 - 在Unreal Engine编辑器中,打开项目设置(Project Settings),在“Platforms”>“Windows”>“Compiler”中,检查是否设置了正确的Visual Studio版本(例如VisualStudio2022)。 - 如果安装了多个版本的Visual Studio,可以尝试通过设置环境变量`PreferredToolArchitecture`为`x64`,以及`VCIDEInstallDir`指向VS2022的安装路径(如`C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\`)来指定首选版本。 此外,由于用户提到了VaRestX插件,我们需要特别注意该插件是否支持UE5.4。根据引用[2]中提到的UE5.4兼容性更新,我们可以推测插件可能需要更新才能兼容。因此,检查插件是否有更新版本,或者查看其GitHub页面(如果有)上的问题跟踪,看是否有类似的问题和解决方案。 如果上述方法不能解决问题,可能需要考虑以下步骤: - 清除Unreal Engine的派生数据缓存(位于C:\Users\<YourUser>\AppData\Local\UnrealEngine\Common\DerivedDataCache),然后重新构建。 - 尝试创建一个全新的UE5.4项目,仅添加VaRestX插件,然后打包测试,以确定是否是项目配置问题。 最后,由于命名冲突问题可能与插件内部的模块定义有关,如果插件开发者没有及时更新,可能需要手动修改插件代码(有一定风险,建议备份)。 下面是具体的步骤: **步骤1:确保插件兼容性** - 确认VaRestX插件支持UE5.4。如果不支持,考虑寻找替代插件或者等待更新。 **步骤2:解决MarketplaceRules.dll无效错误** - 删除项目目录下的`Binaries`、`Intermediate`、`Saved`文件夹以及`.vs`文件夹(如果有)和解决方案文件(.sln)。 - 重新生成项目:右键点击`.uproject`文件,选择“Generate Visual Studio project files”。 - 打开项目,尝试重新编译。 **步骤3:解决命名冲突** - 打开插件文件夹(Plugins/VaRestX/Source),检查是否存在两个模块(例如VaRest和VaRestEditor)的模块定义文件(.Build.cs)和模块头文件(*.h)和源文件(*.cpp)。 - 确保模块名在项目中唯一。如果冲突,修改其中一个模块的名称(例如将VaRestEditor模块改名为VaRestXEditor),并同时修改: - 对应的.Build.cs文件中的模块名(如`public class VaRestEditor : ModuleRules`改为`public class VaRestXEditor : ModuleRules`) - 模块的.cpp文件中的`IMPLEMENT_MODULE`宏(如`IMPLEMENT_MODULE(FVaRestEditorModule, VaRestEditor)`改为`IMPLEMENT_MODULE(FVaRestEditorModule, VaRestXEditor)`) - 在插件的.uplugin文件中,修改"Modules"数组中的每一项的"Name"属性(例如将"VaRestEditor"改为"VaRestXEditor") - 注意:重命名模块需要修改多处,且可能会引起其他依赖问题,因此需谨慎。 **步骤4:设置正确的Visual Studio版本** - 确保已安装VS2022(推荐版本)。 - 在项目设置中,选择“Platforms”>“Windows”,在“Compiler”选项中选择“Visual Studio 2022 (Preview)”。 - 如果问题依旧,可以尝试在项目目录下的`.uproject`文件上右键,选择“Switch Unreal Engine version”重新切换一次引擎版本。 **步骤5:重新编译打包** - 完成以上步骤后,尝试重新编译并打包项目。 如果问题仍然存在,可以考虑在Unreal Engine论坛或插件的支持页面寻求帮助。 §§相关问题§§ 1. 如何检查Unreal Engine插件与特定引擎版本的兼容性? 2. 在Unreal Engine中如何正确重命名模块以避免冲突? 3. 如何设置Unreal Engine项目使用特定版本的Visual Studio编译器? </think>### Unreal Engine 5.4打包项目(含VaRestX插件)报错解决方案 #### 1. **MarketplaceRules.dll文件无效** **原因**:该错误通常由插件未正确编译或引擎版本兼容性问题导致,尤其常见于第三方插件调用商城API时[^1][^3]。 **解决步骤**: - 删除项目目录下的 `Binaries`、`Intermediate`、`Saved` 文件夹 - 打开插件目录(`Plugins/VaRestX/`),删除其下的 `Binaries` 和 `Intermediate` 文件夹 - 右键点击 `.uproject` 文件 → **Generate Visual Studio project files** - 在UE编辑器中:**Tools → Refresh Visual Studio Project** - 重新编译插件源码(需确保已安装C++桌面开发组件)[^3] #### 2. **VaRestEditor和VaRest命名冲突** **原因**:插件模块命名冲突,常见于旧版插件未适配UE5.4的模块管理规范[^2][^3]。 **解决步骤**: ```ini # 修改 VaRestX 插件配置文件(Plugins/VaRestX/VaRestX.uplugin) "Modules": [ { "Name": "VaRestX", # 原"VaRest" "Type": "Runtime" }, { "Name": "VaRestXEditor", # 原"VaRestEditor" "Type": "Editor" } ] ``` - 同步修改源码中的模块声明(`VaRestX.Build.cs` 和 `VaRestXEditor.Build.cs`) - 全局替换代码中的 `VaRest` 为 `VaRestX`(包括头文件引用)[^2] #### 3. **VS编译器版本非首选** **原因**:UE5.4默认依赖VS2022(MSVC v143),旧版编译器会触发兼容性错误[^3]。 **解决步骤**: - 安装 **Visual Studio 2022**(需包含组件: - `.NET桌面开发` - `使用C++的桌面开发` - `Windows 11 SDK(10.0.22621)`) - 设置UE5.4默认编译器: ```bat :: 在项目根目录创建 DefaultEngine.ini 覆盖规则 [WindowsPlatform] WindowsCompiler = VisualStudio2022 ``` - 验证编译器路径: **编辑 → 编辑器偏好设置 → 源代码 → Source Code Editor → Visual Studio 2022** #### 附加建议 1. **插件兼容性检查**: - 确认VaRestX支持UE5.4(参考插件文档或GitHub的Release Notes) - 临时移除其他插件,验证是否冲突[^4] 2. **打包命令修正**: ```bash # 使用完整打包命令避免环境干扰 UnrealEditor.exe ProjectName.uproject -BuildCookRun -targetplatform=Win64 -clientconfig=Development -serverconfig=Development -utf8output -allmaps -compile ``` 3. **依赖库修复**: - 运行 `DirectX修复工具` 确保系统DLL完整 - 安装最新版 `Visual C++ Redistributable(x64)` > 若问题持续,建议检查引擎日志 `Saved/Logs/Launch.log`,搜索 "Error" 或 "Fail" 定位具体堆栈信息[^1][^3]。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值