虚拟实验室-Unreal 版本

虚拟实验室的Unreal 版本,第一个版本主要是以《探究通电螺线管外部的磁场分布》颗粒为例,设计和开发一个正式版本。


UnLua下载、安装、官方Demo说明

<p>[TOC]</p> <h1>下载</h1> <p>官网github地址:<a href="https://github.com/Tencent/UnLua">https://github.com/Tencent/UnLua</a> 分支:develop 分支链接:<a href="https://github.com/Tencent/UnLua/tree/develop">https://github.com/Tencent/UnLua/tree/develop</a></p> <h1>安装</h1> <ol> <li>复制 Plugins 目录到你的UE工程根目录。</li> <li>重新启动你的UE工程</li> </ol> <h1>官方Demo说明</h1> <h2>编译</h2> <p>下载下来后是一个完整的UE工程,使用UE 5.4.2编译会报如下错误</p> <pre><code>Generating VisualStudio2022 project files: Discovering modules, targets and source code for project... Compiled assembly file 'D:\VLabGit\vlab\UnLua-master\Intermediate\Build\BuildRules\TPSProjectModuleRules.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 'D:\VLabGit\vlab\UnLua-master\Intermediate\Build\BuildRules\TPSProjectModuleRules.dll'. Format of the executable (.exe) or library (.dll) is invalid.) D:\VLabGit\vlab\UnLua-master\Plugins\UnLua\Source\ThirdParty\Lua\Lua.Build.cs(445,72): error CS0117: 'WindowsCompiler' does not contain a definition for 'VisualStudio2019' Total execution time: 1.50 seconds Expecting to find a type to be declared in a target rules named 'TPSProjectTarget'. This type must derive from the 'TargetRules' type defined by UnrealBuildTool.</code></pre> <p>此时需要将工程代码中所有</p> <pre><code>DefaultBuildSettings = BuildSettingsVersion.V2;</code></pre> <p>改为</p> <pre><code>DefaultBuildSettings = BuildSettingsVersion.V5;</code></pre> <h2>示例</h2> <p>Tutorials文件夹下</p> <ul> <li>01_HelloWorld 快速开始的例子</li> <li>02_OverrideBlueprintEvents 覆盖蓝图事件(Overridden Functions)</li> <li>03_BindInputs 输入事件绑定</li> <li>04_DynamicBinding 动态绑定</li> <li>05_BindDelegates 委托的绑定、解绑、触发</li> <li>06_NativeContainers 引擎层原生容器访问</li> <li>07_CallLatentFunction 在协程中调用 Latent 函数</li> <li>08_CppCallLua 从C++调用Lua</li> <li>09_StaticExport 静态导出自定义类型到Lua使用</li> <li>10_Replications 覆盖网络复制事件</li> <li>11_ReleaseUMG 释放UMG相关对象</li> <li>12_CustomLoader 自定义加载器</li> <li>13_AnimNotify 动画通知</li> </ul> <h3>示例如何绑定lua文件</h3> <h4>实现接口GetModuleName</h4> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=976feaf5340b9d9fb9c7e7a874fc292e&amp;amp;file=file.png" alt="" /></p> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=234af236b910a3df2a4c36bb43ab680d&amp;amp;file=file.png" alt="" /></p> <h4>创建Lua文件模板</h4> <p>GetModuleName接口返回值处填入相对文件路径,点击创建Lua模板文件 <img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=433fddb110adda28c0b81c52381ac330&amp;amp;file=file.png" alt="" /></p> <p>在Content\Script下会创建填入的相对路径文件 <img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=70d4f6cd91d75532faaab7069abcab3c&amp;amp;file=file.png" alt="" /></p>

页面列表

ITEM_HTML