Export 3D scene and assets in Unity to Cocos Creator.
Unity URP sample scene converted for Cocos and built on the web.
https://amagamina.jp/unity-2-cocos-demo/
-
From Unity's left-hand scene to Cocos' right-hand scene.
-
Image, FBX meshes copy and auto-generate meta files.
-
Support URP material to Cocos material convert. ( If you are using Built-In pipeline, you can convert to URP with the Unity's support. )
-
Map Unity's assets to Cocos' assets. (ex. Unity's Cube mesh -> Cocos' Box mesh)
- Support 3D physics feature. (Collider / Rigidbody etc)
This is an experimental project. Complete conversion is not possible.
Make a backup of your project if you use it.
The following will not be supported. We need your help!
-
Prefab support. (Very complicated...)
-
ParticleSystem / 2D Feature / uGUI convert.
-
Audio / Animation export.
If you are new to CocosCreator, please read this page first to understand the differences between Unity and CocosCreator. https://docs.cocos.com/creator/manual/en/guide/unity/
>= Unity 2022.3.11f1 ( >= URP 14.0.9 )
>= Cocos Creator 3.8.1
To install via upm, specify https://github.com/ina-amagami/Cocos2Unity.git?path=Packages/Unity2Cocos
.
{
"dependencies": {
"jp.amagamina.unity-2-cocos": "https://github.com/ina-amagami/Unity2Cocos.git?path=Packages/Unity2Cocos",
}
}
Or copy /Packages/Unity2Cocos/
into your project.
Use the com.unity.nuget.newtonsoft-json >= 3.0.2
-
Create a CocosCreator project.
-
If using PostProcessVolume or FXAA, set up a custom Cocos rendering pipeline. please see https://docs.cocos.com/creator/manual/en/render-pipeline/post-process/
-
Create a setting file in
Assets/Create
menu select ofUnity2Cocos/ExportSetting
in Unity.
-
Add the scene you want to convert to "Scenes" list.
-
Change settings as needed (see below "Setting").
-
Click "Convert for Cocos".
-
Select export directory (root directory of Cocos project).
FBX mesh uuid that cannot be identified on Unity is modified by Python scripts after importing into Cocos.
- Run the Python script
Packages/Unity2Cocos/Tools/replace_mesh_id.py
.
% python3 ./Packages/Unity2Cocos/Tools/replace_mesh_id.py
Enter the folder path: [Your export directory]
- If you see the following, you have succeeded. Open the scene in Cocos and check it.
...
- Replace: 929e9c50-5f7a-41ae-93db-7aedb8c94ac4@mesh-name:safety_hat_low.mesh -> 3d871
- Replace: b332724b-ff23-422d-9369-99df2ab5a6ac@mesh-name:level_low.mesh -> 78d63
- Replace: d05f7138-939f-4ab0-a06b-1b7e76e0c6c3@mesh-name:safety_goggles_low.mesh -> c40d4
--- Replace mesh id end ---
Title | Status | Remarks |
---|---|---|
Ambient Light | ✅ | Only gradient settings are taken over (because Cocos only supports gradients). |
Shadows | ✅ | Refer to URP pipeline settings. |
Skybox | ❌ | |
Prefab | ❌ | Unpack to a normal GameObject and then convert. |
Title | Status | Remarks |
---|---|---|
Scene | ✅ | Unsupported components will be skipped. |
Prefab | ❌ | |
FBX Model | ✅ | |
Single Mesh and non-FBX formats |
❌ | |
2D Texture | ✅ | Some formats may not be supported by Cocos. |
3D Texture TextureArray |
❌ | |
Sprite | ❌ | |
Material | ✅ | If no MaterialConverter is defined, Cocos' Standard shaders are used. |
Shader | ❌ | Use the one prepared on the Cocos side. |
Terrain | ❌ |
Title | Status | Remarks |
---|---|---|
Transform | ✅ | Converted from left hand coordinate system to right hand coordinate system. |
Mesh Filter & MeshRenderer |
✅ | |
Skinned Mesh Renderer | ❌ | |
Sprite Renderer | ❌ | |
Terrain | ❌ | |
Camera | ✅ | Physical parameters are not supported. |
Light | ✅ | Area light not yet supported (will be in the future). |
LightProbeGroup | ✅ | |
LODGroup | ✅ | |
ReflectionProbe | ✅ | Note that resolution settings are very different between Unity and Cocos. |
Volume (PostProcessing) |
✅ | Global Volume only, uses Cocos PostProcess. Needs to be configured on Cocos side. https://docs.cocos.com/creator/manual/en/render-pipeline/post-process/ Supported only by Bloom, FXAA. |
Colliders | ❌ | Future support. |
Rigidbody | ❌ | Future support. |
Particle System | ❌ | |
Animator | ❌ |
Unity Shader | Cocos Effect |
---|---|
Universal Render Pipeline/Unlit | builtin-unlit |
Universal Render Pipeline/Simple Lit | builtin-standard |
Universal Render Pipeline/Lit | builtin-standard |
Other | builtin-standard |
* If SimpleLit's SpecularMap and Lit's MetallicMap are used, these parameters regenerate the texture since the channels used on the Cocos side are different.
This software is released under the MIT License. https://opensource.org/licenses/mit-license.php
Copyright (c) 2023 ina-amagami / Amagamina Games, Inc. ([email protected])
The UniversalRenderPipeline sample scenes included in the repository were created by Unity Software Inc.