空工程接入组件指南
<p>[toc]</p>
<table>
<thead>
<tr>
<th>最后更新日期</th>
<th>2024-1-22</th>
</tr>
</thead>
<tbody>
<tr>
<td>作者</td>
<td>张煜园</td>
</tr>
<tr>
<td>审订</td>
<td>QFord</td>
</tr>
<tr>
<td>V1.0.0</td>
<td>创建文档-张煜园</td>
</tr>
<tr>
<td>V1.1.0</td>
<td>演示视频、创建空工程的1.2/1.4 修订</td>
</tr>
<tr>
<td>V1.1.1</td>
<td>bat脚本执行的风险提示</td>
</tr>
<tr>
<td>说明</td>
<td>本文档将不定期更新</td>
</tr>
</tbody>
</table>
<h1>演示视频</h1>
<p>[空工程接入[物件播放组件]视频(带字幕)_2K_无码](<a href="http://gerrit.sdp.nd/#/c/895295/">http://gerrit.sdp.nd/#/c/895295/</a> "空工程接入[物件播放组件]视频(带字幕)_2K_无码")</p>
<p>> 接入预估耗时20分钟,视频剪辑后时间有所简短。
后续可通过自动化工具,让接入更快、更简单!</p>
<h1>1. 创建空的U3D工程</h1>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e4ba02648dfe1ada8be3359633b5e6a1&amp;file=file.png" alt="" /></p>
<p>> 1.1: Unity版本使用【2021.3.20f1c1】,版本要跟随整个项目(后面可能升级)。
1.2 :模版选择【3D(URP)】- 如果没有找到这个模板,请升级Unity Hub。
1.3 :不用勾选版本管理,设置好项目名称和存放路径
1.4 :【注意】工程不放在太深的目录,以免文件路径字符长度超过Win系统260限制而导致的错误</p>
<h1>2.工程设置</h1>
<h2>2.1: 设置UPM URL</h2>
<pre><code>1.菜单点击window
2.找到package manager选项打开
3.点击package manager上方的齿轮图标
4.设置完成后点击Apply</code></pre>
<pre><code>&quot;name&quot;: &quot;SDP&quot;,
&quot;url&quot;: &quot;http://nexus.sdp.nd/repository/unity-upm&quot;,
&quot;scopes&quot;: [&quot;com.nd&quot;]</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=5ae6d03b43db899f911a50c50cf929ee&amp;file=file.png" alt="" /></p>
<h2>2 工程设置</h2>
<h3>2.1 导入物件播放器package包</h3>
<pre><code>1.菜单栏点击window,找到Package Manager
2.点击+号按钮,选择Add package by name
3.输入com.nd.vlab-equipmentplayer,点击Add按钮
4.会默认下载一个版本,下载成功后,点击See other version展开,选中版本,点击窗口右下处的Update to xxxxx</code></pre>
<p><span style="color:red; font-size: 2em;">物件播放器目前版本1.1.0-F0-pre1</span>
图1
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=31096b8d9ddf050ec91e3b80384236c2&amp;file=file.png" alt="" />
图2
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e8a5be344f97cdaa497e0b66c1f3967d&amp;file=file.png" alt="" />
图3
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=b13dea7dc2b5c2b2421cad139d572318&amp;file=file.png" alt="" /></p>
<h3>2.2 执行批处理脚本</h3>
<p>> <font color = red>仅适用于空工程,旧工程使用存在覆盖项目设置的风险。
旧工程则可以进行人工比对、评估风险和自测,具体内容请往下看。</font></p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=d25c6fc32f37afc502112dfce161c211&amp;file=file.png" alt="" /></p>
<pre><code>1.在工程下方的Project中找到vlab-equipmentplay,右键打开菜单,选中show in explorer打开组件目录。
2.将1.拷贝Asset包.txt的后缀.txt修改为.bat。(如果系统没有显示后缀名,可按下图2调出)
3.在com.nd.vlab-equipmentplayer\Plugins目录中双击执行1.拷贝Asset包.bat【图3】</code></pre>
<p>【图1】
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=52efbe4f8caa5f2b9101f0ddc06bba2c&amp;file=file.png" alt="" />
【图2】
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=bc681dc4c95b77f844c26acf371bf69a&amp;file=file.png" alt="" /></p>
<p><span style="color:red; font-size: 2em;">脚本执行完后工程可能会报下面错误,需要重新启动下工程,因为有些工程配置文件是直接拷贝的,需要重启工程生效</span>
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=62d033552145df8eef98b8e24c05bab4&amp;file=file.png" alt="" /></p>
<h2>3:导入TextmeshPro资源包</h2>
<pre><code>Packages目录下找到TextMeshPro包,双击TMP Essential Resources选择import</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=9045ef3b9ad5a1db2418241815e9e65e&amp;file=file.png" alt="" /></p>
<h2>4:启动测试场景-验证</h2>
<pre><code>1.Packages目录下找到vlab-equipmentplayer,在Scenes文件夹中找到Test场景文件。【图1】
2.左键拖拽场景到工程内Scenes目录。【图2】
3.双击打开Test场景【图3】</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=8401d8ae006c3d5343da048c48bf522a&amp;file=file.png" alt="" /></p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e6061209f765b1f82de13ca32a9eab29&amp;file=file.png" alt="" /></p>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=7e5abd31ab27d0c534fdc49edee256ad&amp;file=file.png" alt="" /></p>
<h1>2.2:工程设置(批处理已处理,下面的就不用手动搞了)</h1>
<pre><code>1.菜单点击Edit
2.找到project setting选项打开
3.下拉点击player选项</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=71f1315dc2fe90e109889b8ff3bb244f&amp;file=file.png" alt="" /></p>
<h2>2.3:宏设置</h2>
<pre><code>1.下拉点击player选项
2.找到script compilation
3.点击两次+号,输入URP_RENDER_PIPELINE和THREAD_SAFE
4.点击Apply保存</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=2adb0fd526d1b4035161c7ce7dc1c20e&amp;file=file.png" alt="" /></p>
<h2>2.4.NET API设置</h2>
<pre><code>1.依旧是在player选项中,下拉找到Api Compatibility Level
2.修改为.NET Framwork</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=89efb202267ab5c6e0a0168cda7fd6e0&amp;file=file.png" alt="" /></p>
<h2>3:导入物件播放器package包</h2>
<p><span style="color:red; font-size: 2em;">物件播放器目前版本1.0.0-xxx</span></p>
<h3>方法1</h3>
<p>图1
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=31096b8d9ddf050ec91e3b80384236c2&amp;file=file.png" alt="" />
图2
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e8a5be344f97cdaa497e0b66c1f3967d&amp;file=file.png" alt="" />
图3
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=df3ed2f22ffb648a87021bd87af12248&amp;file=file.png" alt="" /></p>
<pre><code>1.菜单栏点击window,找到Package Manager
2.点击+号按钮,选择Add package by name
3.输入com.nd.vlab-equipmentplayer,点击Add按钮
4.会默认下载一个版本,下载成功后,点击See other version展开,选中版本,点击窗口右下处的Update to xxxxx</code></pre>
<h3>方法2</h3>
<pre><code>打开工程Packages文件夹下的manifest文件,加入下面内容
&quot;com.unity.modules.xr&quot;: &quot;1.0.0&quot;,
&quot;com.nd.vlab-equipmentplayer&quot;:&quot;0.9.9-F5-pre1&quot; &lt;=加入这行 版本号待指定,先使用0.9.9-F5-pre1测试,周三提测后为1.0.0
},
&quot;scopedRegistries&quot;: [</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=0bd03f19bb7168faaf913caf170ce462&amp;file=file.png" alt="" /></p>
<h2>4:Tag & Layer 设置</h2>
<pre><code>将物件播放器包vlab-equipmentplayer\Plugins\ProjectSettings文件夹中的TagManager.asset拷贝到U3D工程的ProjectSettings下</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=aefc627e12a9ebb8834d55c3ca1fa2b0&amp;file=file.png" alt="" /></p>
<h2>5:ModuleConfig.json</h2>
<pre><code>将物件播放器包vlab-equipmentplayer\Plugins\ProjectSettings文件夹中的ModuleConfig.json拷贝到U3D工程和Assets同级的目录下</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=84d26eebd1edba66d29e166b0f4c0090&amp;file=file.png" alt="" /></p>
<h2>6:Assets包解压</h2>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=4af4a3390a090792195b926be9ee2201&amp;file=file.png" alt="" /></p>
<pre><code>从原工程拷贝下面3个文件夹(AssetsPackage,Resources,StreamingAssets),
将文件夹拷贝到U3D工程和Assets目录下
或者可以从下面的链接下载</code></pre>
<p>[assets下载](<a href="http://192.168.58.236/vlab/%E3%80%90%E7%89%A9%E4%BB%B6%E6%92%AD%E6%94%BE%E5%99%A8%E3%80%91%E6%B5%8B%E8%AF%95%E7%94%A8%E9%A2%97%E7%B2%92/">http://192.168.58.236/vlab/%E3%80%90%E7%89%A9%E4%BB%B6%E6%92%AD%E6%94%BE%E5%99%A8%E3%80%91%E6%B5%8B%E8%AF%95%E7%94%A8%E9%A2%97%E7%B2%92/</a> "assets下载")
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=8285e467bb54a7fd5fa7e65d6ef68150&amp;file=file.png" alt="" /></p>