EgretEngineとUnityを連動させてみる(2)

こちらの記事「[EgretEngineとUnityを連動させてみる(1)](https://qiita.com/motoyasu-yamada/items/c0edc2e22f235f138bbd)」の続き

# インストール
GitHubからZipをダウンロードして「Egret3DExportTools」を解凍してください。
そのディレクトリをプロジェクトのAssetsフォルダにをぶちこんでください。
このようになるはずです。
![image.png](https://qiita-image-store.s3.amazonaws.com/0/302078/d55c72c4-3107-c887-8303-57fa704be0c7.png)

GitHub: https://github.com/egret-labs/egret3d-unityplugin/

プラグインアセットのビルドが終わると下記のようにメニューが表示されるはずです。

![image.png](https://qiita-image-store.s3.amazonaws.com/0/302078/ad0b9719-7655-3229-3ee8-f5c07b7abfe8.png)


# 書き出しをテストする

メニューの`Egret3DExportTool`から`OpenWindow`を選択してください
![image.png](https://qiita-image-store.s3.amazonaws.com/0/302078/be0bddc1-7d1c-e50f-2755-1f161d3660c4.png)

## 画面の説明
|中国語|英語|
|----|-----|
|当前导出路径|Current Export Path|
|选择目录|Select Directory|
|输出日志|Output Log|
|坐标归零|Coordinate zero|
|导出原始图片|Export original image|
|光照设置|Lighting settings|
|网格设置|Grid settings|
|资源导出工具| Resource Export Tool|
|导出当前选中对象|Export Currently Selected Objects|
|场景导出工具|Scene Export Tool|
|导出当前场景|Export Current Scene|

# ひとまず実行しよう
画面上部の选择目录(Select Directory)を選択して、書き出し先ディレクトリを設定してください。
どうも`-`をディレクトリ名に使うと`_`に変換されるので気をつけてください。

その後

输出日志(Output Log)をオフ
坐标归零(Coordinate zero)をオフ
导出原始图片(Export original image)をオン
光照设置(Lighting settings)をNone
网格设置(Grid settings)はすべてオン

にして

场景导出工具（Scene Export Tool)にチェックを入れると、ボタン「导出当前场景(Export Current Scene)」が表示されますので押してエクスポートを実行してください。

## エクスポート結果

![image.png](https://qiita-image-store.s3.amazonaws.com/0/302078/a3182c7d-0fa1-91bd-79af-64ee51501a6a.png)

![image.png](https://qiita-image-store.s3.amazonaws.com/0/302078/1d8ebf4b-6551-e9a8-25f8-b618e483ed47.png)

![image.png](https://qiita-image-store.s3.amazonaws.com/0/302078/e4128e4f-d2f1-ae71-fadf-13cf9a036eab.png)

```json:samplescene.scene.json
{
	"assets":[
		"Library/Cube.mesh.bin",
		"Assets/Materials/wall.fw.mat.json",
		"Assets/Materials/madchari.fw.mat.json",
		"Assets/Materials/madgreen.fw.mat.json"
	],
	"objects":[
		{"uuid":"1","unityId":-1052,"class":"paper.Scene","name":"SampleScene","ambientColor":[1,1,1,1],"lightmapIntensity":0.1,"gameObjects":[{"uuid":"2"},{"uuid":"3"},{"uuid":"4"},{"uuid":"5"},{"uuid":"6"}],"lightmaps":[]},
		{"uuid":"2","unityId":11436,"class":"paper.GameObject","name":"Wall","tag":"Untagged","layer":1,"isStatic":false,"components":[{"uuid":"7"},{"uuid":"8"},{"uuid":"9"},{"uuid":"10"}]},
		{"uuid":"4","unityId":11452,"class":"paper.GameObject","name":"Main Camera","tag":"Untagged","layer":1,"isStatic":false,"components":[{"uuid":"11"},{"uuid":"12"}]},
		{"uuid":"3","unityId":11446,"class":"paper.GameObject","name":"Directional Light","tag":"Untagged","layer":1,"isStatic":false,"components":[{"uuid":"13"},{"uuid":"14"}]},
		{"uuid":"5","unityId":11460,"class":"paper.GameObject","name":"Cube","tag":"Untagged","layer":1,"isStatic":false,"components":[{"uuid":"15"},{"uuid":"16"},{"uuid":"17"},{"uuid":"18"}]},
		{"uuid":"6","unityId":11470,"class":"paper.GameObject","name":"Platform","tag":"Untagged","layer":1,"isStatic":false,"components":[{"uuid":"19"},{"uuid":"20"},{"uuid":"21"},{"uuid":"22"}]}
	],
	"components":[
		{"uuid":"7","unityId":11438,"class":"egret3d.Transform","localPosition":[0,1,0],"localRotation":[0,0,0,1],"localScale":[10,1,10],"children":[]},
		{"uuid":"8","unityId":11444,"class":"egret3d.MeshFilter","_mesh":{"asset":0}},
		{"uuid":"9","unityId":11442,"class":"egret3d.MeshRenderer","_lightmapIndex":-1,"_castShadows":true,"_receiveShadows":true,"_lightmapScaleOffset":[1,1,0,0],"_materials":[{"asset":1}]},
		{"uuid":"10","unityId":11440,"class":"egret3d.BoxCollider","aabb":[-0.5,-0.5,-0.5,0.5,0.5,0.5]},
		{"uuid":"11","unityId":11458,"class":"egret3d.Transform","localPosition":[0,5,-10],"localRotation":[0,0,0,1],"localScale":[1,1,1],"children":[{"uuid":"13"}]},
		{"uuid":"12","unityId":11456,"class":"egret3d.Camera","fov":1.0471,"opvalue":1,"_near":0.3,"_far":1000,"cullingMask":-1,"clearOption_Color":true,"clearOption_Depth":true,"backgroundColor":[0.192157,0.301961,0.47451,0],"viewport":[0,0,1,1],"order":-1},
		{"uuid":"13","unityId":11450,"class":"egret3d.Transform","localPosition":[5,1,0],"localRotation":[0,0,0,1],"localScale":[1,1,1],"_parent":{"uuid":"11"},"children":[]},
		{"uuid":"14","unityId":11448,"class":"egret3d.DirectionalLight","castShadows":true,"color":[1,0.956863,0.839216,1],"intensity":0.21},
		{"uuid":"15","unityId":11468,"class":"egret3d.Transform","localPosition":[0,5,0],"localRotation":[0.408218,-0.23457,0.109382,0.875426],"localScale":[1,1,1],"children":[]},
		{"uuid":"16","unityId":11466,"class":"egret3d.MeshFilter","_mesh":{"asset":0}},
		{"uuid":"17","unityId":11464,"class":"egret3d.MeshRenderer","_lightmapIndex":-1,"_castShadows":true,"_receiveShadows":true,"_lightmapScaleOffset":[1,1,0,0],"_materials":[{"asset":2}]},
		{"uuid":"18","unityId":11462,"class":"egret3d.BoxCollider","aabb":[-0.5,-0.5,-0.5,0.5,0.5,0.5]},
		{"uuid":"19","unityId":11478,"class":"egret3d.Transform","localPosition":[0,0,0],"localRotation":[0,0,0,1],"localScale":[1000,1,1000],"children":[]},
		{"uuid":"20","unityId":11476,"class":"egret3d.MeshFilter","_mesh":{"asset":0}},
		{"uuid":"21","unityId":11474,"class":"egret3d.MeshRenderer","_lightmapIndex":-1,"_castShadows":true,"_receiveShadows":true,"_lightmapScaleOffset":[1,1,0,0],"_materials":[{"asset":3}]},
		{"uuid":"22","unityId":11472,"class":"egret3d.BoxCollider","aabb":[-0.5,-0.5,-0.5,0.5,0.5,0.5]}
	],

	"version":4
}
```