• Stars
    star
    123
  • Rank 289,031 (Top 6 %)
  • Language
    C#
  • Created over 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An experimental converter from Unity to Godot game engines

Unity Engine to Godot Engine exporter

This is an experimental script that allows you to convert all scenes in your Unity project into a Godot project. It is not aimed at doing everything automatically, only things that can be converted decently. It's only a proof of concept on simple 2D games for now, and a ton of work remains to be done if it were to support everything else. While there are always cases where conversion is ambiguous and things to do manually, it's still fun to at least have the ability to automate this to some extent.

I have other projects to work on so I won't work much on this tool for now, and I am aware that there is an abysmal amount of features it could support^^ But feel free to hack around with it and improve it if you like the idea.

How to install

Copy this repository in your Unity project, inside a folder named Editor, and you should see a new Godot menu with options in it.

Although it should not modify anything in the project, it's up to you to preserve your data if anything wrong happens :p

Some challenges

Here is a random list of things I had to take choices, for which workarounds may or may not exist. There may be a lot more, but you can get an idea of what this tool has to get through:

  • Unity only has Camera, but Godot has Camera2D and Camera for 3D. Choosing which one is ambiguous, so for now I create the 2D version of the camera is orthographic AND if a hint is enabled in the exporter for 2D projects. Also, in Unity, cameras also act as viewports, which is another separate node in Godot, so I'm not sure how to even convert those. Other components are ambiguous too, such as Light.

  • Godot has separate engines for 2D and 3D, but Unity only has 3D transforms with ortho camera. So the tool tries to guess what usage a GameObject is for by looking at its components. For example, if it has SpriteRenderer, or any of its children does, then the GameObject is converted to a Node2D. Otherwise, it becomes a Spatial. In some cases, it becomes a blank Node in cases where dimensions are irrelevant.

  • Unity uses components attached to GameObjects for its functionality, but Godot uses a node tree directly. That means a single GameObject with several components may convert into one node and several child nodes. If a GameObject only has a Transform and one component, a shortcut is taken to only produce a single Godot node, eliminating the unnecessary nesting.

  • Unity defines rigidbodies as components, but in Godot it is recommended to have such bodies as parent nodes because they control the position of their children, so instead of adding RigidBodies as a child nodes, they are have to be promoted as parent.

  • Unity can have multiple scripts on the same GameObject, but Godot can only have one per node. So the converter takes the first script it finds to the root node, and create children Nodes for each additional script. You may have to have a manual look after conversion if you use composition a lot.

  • Converting scripts is very complicated, so the tool rather creates stub scripts for each of them so it can still attach them to the proper final nodes, and attempts to preserve serialized variables. For example, when converting to GDScript, a C# script will be parsed for its variables which will be written as export on top of an empty GDScript, and the rest or the original source code is written as a big comment below them. This allows to keep configurations and keep track of what the script should be.

  • In Sprite texture resources, Unity allows to define a scaling between pixel coordinates and world coordinates, which is 100 by default, making sprites very small. Godot uses pixels as units at all times, so the plugin attempts to undo this scaling.

  • Unity can subdivide a 2D texture into sprites, so this almost always translates to Godot as AtlasTextures.

  • Unity uses a left-handed coordinate system, and in 2D its Y axis stays upwards. In Godot, the Y axis in 2D is downwards, so the tool attempts to invert positions (not working as best as it could at the moment)

  • Godot has no terrain system as of now, but a plugin exists for heightmaps which does not require recompilation. So the plugin could be packaged in the output project, and Unity terrains could be mostly converted to that format.

  • Things requiring a recompilation of Godot cannot be supported, for example the Admob module needs to be integrated into Godot manually by recompiling the engine.

  • Unity and Godot both support prefabs and nested prefabs, but I haven't worked in this part yet. On Unity side it should be a matter of using PrefabUtility to detect if a game object is actually an instance of a prefab, and it needs some research to see which delta-modifications are supported both by Unity and Godot.

  • As of 3.1 Godot only saves non-default values in scene data, but this tool can't afford to know them all, so scenes generated by it may be larger than if you had created them in Godot. Saving them from Godot might get rid of the redundancy.

  • Unity can imports 3D models as "fixed" prefabs, a bit like Godot does, so I am not sure if the tool should generate scenes for those, or let Godot do it

More Repositories

1

godot_voxel

Voxel module for Godot Engine
C++
2,105
star
2

godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
GDScript
1,472
star
3

voxelgame

Voxel world prototype made with Godot Engine
GDScript
432
star
4

godot_scatter_plugin

A tool to help placing lots of environment props in a scene
GDScript
178
star
5

godot_tree_generator_plugin

Tool for generating trees in Godot Engine
C++
147
star
6

solar_system_demo

Demo of a space game made with Godot and voxels
GDScript
144
star
7

godot_editor_debugger_plugin

A plugin to inspect the editor's scene tree itself, within the editor.
GDScript
134
star
8

godot_terrain_plugin

3D Terrain plugin for Godot Engine [NO LONGER MAINTAINED]
GDScript
128
star
9

godot_debug_draw

Debug drawing utility for Godot Engine
GDScript
89
star
10

godot_sdf_blender

Compose volumetric models using Signed Distance Fields
GDScript
72
star
11

godot_heightmap_module

Heightmap module for Godot Engine 3.0 [NO LONGER_MAINTAINED]
C++
64
star
12

godot_atmosphere_shader

Planet atmosphere shader for Godot Engine
GDScript
60
star
13

godot_hterrain_demo

Terrain demo project in Godot Engine 3
GDScript
47
star
14

godot_opensimplex

[NO LONGER MAINTAINED] Open simplex noise module for Godot
C
41
star
15

godot_translation_editor

Translation editor plugin for Godot Engine
GDScript
38
star
16

godot_scene_code_converter

Convert Godot scene branches into C++ engine-side code
GDScript
35
star
17

gdscript_performance

Tests to measure Godot performance
GDScript
27
star
18

godot_grapher

A simple graphing application made with Godot Engine
GDScript
26
star
19

godot_blackhole_plugin

2D black hole effect for Godot Engine
23
star
20

fluid2d_demo

Prototype showing a 2D cellular automata simulating a fluid
GDScript
23
star
21

godot_channel_packer_plugin

Tool to pack texture channels in Godot Engine
GDScript
22
star
22

godot_fastnoise

FastNoise library integration for Godot Engine
C++
20
star
23

AudioToy

A web-based toy to generate sound from Javascript code (wavepot.com clone).
CSS
18
star
24

zprofiler

A CPU time profiler for Godot Engine
C++
17
star
25

godot_collision_scanner

Raycast-based collision viewer for Godot Engine
GDScript
16
star
26

SnowfeetEngine

C++ game engine
C
16
star
27

godot_texture_generator

Node-based texture generator
GDScript
15
star
28

zCraft

A C++ poly-voxel prototype
C++
15
star
29

godot_project_statistics

Project statistics plugin for Godot Engine 3
GDScript
15
star
30

Simciv

City builder game
Java
11
star
31

godot_music_manager

A simple music player that supports fading
GDScript
10
star
32

godot_3d_basics

Small set of useful assets for 3D game development using Godot Engine 4.x.
GDScript
10
star
33

godot_editor_light_plugin

A plugin lighting up scenes which don't have any light in the editor
GDScript
9
star
34

hex_viewer

Hex file viewer made with Godot Engine
GDScript
9
star
35

godot_text_editor

A text editor remade in GDScript for fun
GDScript
7
star
36

godot_fast_noise_lite_shader

FastNoiseLite port to Godot Engine shaders
6
star
37

godot_code_minimap_plugin

Code minimap plugin for Godot Engine 3
GDScript
6
star
38

voxel_raytracing

Voxel raytracing experiments
GLSL
6
star
39

marbles

Marble race game made with Godot for Isolation Game Jam 2019
GDScript
6
star
40

AudioRift

A visual HTML5 audio player
JavaScript
6
star
41

godot_hextile

Hextile texturing demo for Godot Engine
5
star
42

SnowfeetFramework

A C++ 2D game engine prototype
C++
5
star
43

godot_profiling_viewer

A viewer for profiling dumps made with Godot Engine
GDScript
5
star
44

saga_toolkit_app

A set of GUI tools for hobbyist audio series production
GDScript
5
star
45

vulkan_thing

Learning Vulkan
C++
4
star
46

DCPU16

A DCPU16 emulator and assembler written in C++
C++
4
star
47

SimcivOnline

An attempt to create an online world and city simulator
C++
4
star
48

godot_flyer_test

Test project made with Godot 3.0 (pre-alpha)
GDScript
3
star
49

Grid

2D shooter game
C++
3
star
50

OrganSampler

Organ sampler plugin compatible with GrandOrgue files (VST2/RTAS/AAX)
C++
3
star
51

mosaic

Photomosaic generator made with Godot Engine
GDScript
3
star
52

audacity2reaper

An experimental project converter from Audacity to Reaper
Python
3
star
53

flowgraph

A tool to make quick graphs
GDScript
3
star
54

godot_imhex

Godot Engine binary formats for ImHex
2
star
55

LostWithACompass

My Ludum Dare #30 compo game
C#
2
star
56

SML

JSON-like data format with sugar
C++
2
star
57

SagaToolkit

A set of tools for audio plays production
Python
2
star
58

UDKTest

UDK test for learning.
UnrealScript
1
star
59

ToyVM

Stack-based script language, made for fun
C++
1
star
60

GGJ14

Canard (french for Duck)
C#
1
star