# 独自のバイナリファイルを、パッケージに含める事は可能でしょうか？

**URL:** <https://forums.unrealengine.com/t/topic/434435>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [September 25, 2018, 4:27am UTC](https://forums.unrealengine.com/t/topic/434435 "2018-09-25T04:27:07Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sossy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sossy](https://forums.unrealengine.com/u/Sossy)\
**Post date:** [September 25, 2018, 4:27am UTC](https://forums.unrealengine.com/t/topic/434435/1 "2018-09-25T04:27:07Z")

</div>

自作ツールのバイナリファイルを利用する為、IPlatformFile::OpenRead()を使用しファイルの読み込みを行おうと考えております。

実際、ファイルの読み込みは行えているのですが、読み込むファイルを手動でContentフォルダにコピーしておいてあるだけなので、パッケージ化した際に当然、読み込みたい独自ファイルがパッケージに含まれません。

そこで質問なのですが、独自のバイナリファイルを、パッケージに含めることは可能なのでしょうか？  
可能ならば、やり方をご教授いただけますと幸いです。

よろしくおねがいします。

---

<div class="post-metadata">

**Author:** ![T\_Sumisaki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@T\_Sumisaki](https://forums.unrealengine.com/u/T_Sumisaki)\
**Post date:** [September 26, 2018, 1:29pm UTC](https://forums.unrealengine.com/t/topic/434435/2 "2018-09-26T13:29:05Z")

</div>

このあたりが参考になるのではないでしょうか

[https://usagi.hatenablog.jp/entry/2018/03/14/082509](https://usagi.hatenablog.jp/entry/2018/03/14/082509)

> **[Using thirdparty libraries in our UE4 mobile/desktop project – Parallelcube](https://www.parallelcube.com/2018/03/01/using-thirdparty-libraries-in-our-ue4-mobile-project/)**
>
> Learn how to create games using Unreal Engine 4, useful tutorials for beginners, intermediate and experts

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![Sossy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sossy](https://forums.unrealengine.com/u/Sossy)\
**Post date:** [September 27, 2018, 11:13am UTC](https://forums.unrealengine.com/t/topic/434435/3 "2018-09-27T11:13:11Z")

</div>

ご回答ありがとうございます。

教えていただいたURLを拝見しましたが、当方のやりたいことと少し違ったようです。

ライブラリ等のプログラムをリンクしたいのではなく、アセットとして登録していないファイルをパッケージ内に含めたビルドを行いたいのです…

お返事いただきましたが、当方の質問の仕方が悪かったようで、大変失礼いたしました。

---

<div class="post-metadata">

**Author:** ![T\_Sumisaki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@T\_Sumisaki](https://forums.unrealengine.com/u/T_Sumisaki)\
**Post date:** [September 27, 2018, 2:12pm UTC](https://forums.unrealengine.com/t/topic/434435/4 "2018-09-27T14:12:02Z")

</div>

アセットではなく完全に独立したバイナリであれば、UE4のパッケージングの範疇外になりますので、ビルド完了後に別途バッチ等でコピーを行うのが適切と考えます。

あくまでもパッケージングに含まれるのはUE4がアセットとして管理しているもの、つまりコンテンツブラウザに登録されているもののみとなります。

---

<div class="post-metadata">

**Author:** ![alwei](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alwei/32/1194579_2.png) [@alwei](https://forums.unrealengine.com/u/alwei)\
**Post date:** [September 27, 2018, 2:30pm UTC](https://forums.unrealengine.com/t/topic/434435/5 "2018-09-27T14:30:07Z")

</div>

UE4のパッケージング時に含めることが可能なバイナリーファイルはあくまでもUE4上にインポートされたuasset形式のファイルのみです。独自形式のバイナリーであってもUE4でインポートさせる必要があります。(もちろんその際にはC++でインポーターを書く必要があります)

バイナリーをランタイム時に読み込み、それを一時データとして読み込むということは可能ですが、独自形式のままパッケージングということでしたら不可能という結論になります。

---

<div class="post-metadata">

**Author:** ![Sossy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sossy](https://forums.unrealengine.com/u/Sossy)\
**Post date:** [September 28, 2018, 10:58am UTC](https://forums.unrealengine.com/t/topic/434435/6 "2018-09-28T10:58:21Z")

</div>

独自アセットとして実装する方向で行ってみようと思います。  
ご回答ありがとうございました。

---

<div class="post-metadata">

**Author:** ![Sossy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sossy](https://forums.unrealengine.com/u/Sossy)\
**Post date:** [September 28, 2018, 10:58am UTC](https://forums.unrealengine.com/t/topic/434435/7 "2018-09-28T10:58:26Z")

</div>

独自アセットとして実装する方向で行ってみようと思います。  
ご回答ありがとうございました。

---

<div class="post-metadata">

**Author:** ![paperbag](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paperbag](https://forums.unrealengine.com/u/paperbag)\
**Post date:** [October 1, 2018, 3:11am UTC](https://forums.unrealengine.com/t/topic/434435/8 "2018-10-01T03:11:00Z")

</div>

回答済になっていますが、使えるかもしれないので一応共有を…  
  
Content以下にデータがあるのであれば  
  
ProjectSettings → Packaging → Additional Asset Directories to Cook  
  
にパスを指定してやればパッケージングした際にデータが含まれており、読み込めるのではないでしょうか。  
  
  
  
自分は独自バイナリではないですが、ゲームから参照しない外部データを含ませる際にこちらで対応しています。

---

<div class="post-metadata">

**Author:** ![paperbag](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paperbag](https://forums.unrealengine.com/u/paperbag)\
**Post date:** [October 1, 2018, 3:21am UTC](https://forums.unrealengine.com/t/topic/434435/9 "2018-10-01T03:21:48Z")

</div>

もしくはファイル数が少ない場合ですが  
  
Build.csにRuntimeDependenciesから追加することでパッケージング時に追加できると思います  
  
その場合はAdditional Asset Directories to Cookで追加した場合と異なり  
  
pakファイルには含まれません。

---

<div class="post-metadata">

**Author:** ![Sossy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sossy](https://forums.unrealengine.com/u/Sossy)\
**Post date:** [October 1, 2018, 9:46am UTC](https://forums.unrealengine.com/t/topic/434435/10 "2018-10-01T09:46:00Z")

</div>

これが正に求めていたものです。ありがとうございます。  
真っ先にパッケージ化の設定は確認したのですが、見落としてしまっていたようです。

Additional Asset Directories to Cookではなく、Additional Non-Asset Directories to Packageで  
望んだ動作になりそうです。

情報ありがとうございました。
