De Unity3D à Godot Engine

Este guia provê uma visão geral do motor Godot do ponto de vista de um usuário Unity, e procura te ajudar a migrar sua experiência em Unity para o mundo do Godot.


This article talks about older versions of Unity. Nestable prefabs (‘Nested prefabs’) were added to Unity 2018.3. Nestable prefabs are analogous to Godot’s scenes, and allow a more Godot-like approach to scene organisation.


  Unity Godot
Licença Proprietário, código fechado, licença grátis com teto de rendimento e restrições de uso Licença MIT, grátis e código totalmente aberto sem nenhuma restrição
OS (editor) Windows, macOS, Linux (não oficial e sem suporte) Windows, macOS, X11 (Linux, *BSD)
OS (exportar)
  • Desktop: Windows, mac OS, Linux
  • Dispositivos móveis: Android, iOS, Windows Phone, Tizen
  • Web: WebAssembly ou asm.js
  • Consoles: PS4, PS Vita, Xbox One, Xbox 360, Wii U, Nintendo 3DS
  • VR: Oculus Rift, SteamVR, Google Cardboard, Playstation VR, Gear VR, HoloLens
  • TV: Android TV, Samsung Smart TV, tvOS
  • Desktop: Windows, mac OS, X11
  • Dispositivos móveis: Android, iOS
  • Web: WebAssembly
  • Console: Ver Console support in Godot
  • VR: Oculus Rift, SteamVR
Sistema de cenas
  • Componente/Cena (GameObject > Component)
  • Prefabs
Árvore de cenas e nós, permitindo que cenas sejam aninhadas e/ou herdem outras cenas
Ferramentas de terceiros Visual Studio ou VS Code
Vantagens notáveis
  • Comunidade enorme
  • Grande armazém de recursos

O editor

Godot Engine provides a rich-featured editor that allows you to build your games. The pictures below display the default layouts of both editors with colored blocks to indicate common functionalities.

../../_images/unity-gui-overlay.png ../../_images/godot-gui-overlay.png

While both editors may seem similar, there are many differences below the surface. Both let you organize the project using the filesystem, but Godot’s approach is simpler with a single configuration file, minimalist text format, and no metadata. This makes Godot more friendly to VCS systems, such as Git, Subversion, or Mercurial.

Godot’s Scene panel is similar to Unity’s Hierarchy panel but, as each node has a specific function, the approach used by Godot is more visually descriptive. It’s easier to understand what a scene does at a glance.

The Inspector in Godot is more minimal, it shows only properties. Thanks to this, objects can expose more useful parameters to the user without having to hide functionality in language APIs. As a plus, Godot allows animating any of those properties visually. Changing colors, textures, enumerations, or even links to resources in real-time is possible without needing to write code.

The Toolbar at the top of the screen is similar in both editors, offering control over project playback. Projects in Godot run in a separate window, rather than inside the editor (but the tree and objects can still be explored in the debugger window).

This approach has the disadvantage that in Godot the running game can’t be explored from different angles (though this may be supported in the future and displaying collision gizmos in the running game is already possible), but in exchange has several advantages:

  • Executar o projeto e fechá-lo é rápido (A Unity precisa salvar, executar o projeto, fechar o projeto e, em seguida, recarregar o estado anterior).
  • A edição ao vivo é muito mais útil porque as alterações feitas ao editor entram em vigor imediatamente no jogo e não são perdidas (nem precisam ser sincronizadas) quando o jogo é fechado. Isso permite fluxos de trabalho fantásticos, como criar níveis enquanto você os reproduz.
  • O editor é mais estável porque o jogo é executado em um processo separado.

Finally, Godot’s top toolbar includes a menu for remote debugging. These options allow deployment to a device (connected phone, tablet, or browser via HTML5), and debugging/live editing on it after the game is exported.

O sistema de cena

This is the most important difference between Unity and Godot and the favourite feature of most Godot users.

Working on a ‘level’ in Unity usually means embedding all the required assets in a scene and linking them together with components and scripts.

Godot’s scene system is superficially similar to Unity. A ‘level’ consists of a collection of nodes, each with its own purpose: Sprite, Mesh, Light, etc. However, in Godot the nodes are arranged in a tree. Each node can have multiple children, which makes each a subscene of the main scene. This means you can compose a whole scene with different scenes stored in different files.

Por exemplo, pense em um nível de plataforma. Você poderia compor com vários elementos:

  • Tijolos
  • Moedas
  • O jogador
  • Os inimigos

Na Unity, você colocaria todos os GameObjects na cena: o jogador, várias instâncias de inimigos, tijolos em todos os lugares para formar o chão do nível e, em seguida, várias instâncias de moedas em todo o nível. Você adicionaria vários componentes a cada elemento para vinculá-los e adicionar lógica ao nível: por exemplo, você adicionaria um BoxCollider2D a todos os elementos da cena para que eles pudessem colidir. Este princípio é diferente na Godot.

In Godot, you would split your whole scene into three separate, smaller scenes, and instance them in the main scene.

  1. A scene for the Player alone.

Consider the player as an element we’d like to use in different parent scenes (for instance ‘level’ scenes). In our case, the player element needs at least an AnimatedSprite node. This node contains the sprite textures necessary for various animations (for example, a walking animation).

  1. A scene for the Enemy.

An enemy is also an element we’d like to use in several scenes. It’s almost the same as the Player node. The only differences are the script (it needs ‘AI’ routines to generate the enemy’s behaviour) and the sprite textures used by the AnimatedSprite node.

  1. A Level scene.

A Level scene is composed of Bricks (for platforms), Coins (for the player to collect) and a number of instances of the Enemy scene. Each instance is a node in the Level scene tree. These instances are separate enemies, which initially have shared behaviour and appearance as defined in the Enemy scene. You can set different properties for each Enemy node (to change its color, for example).

4. A Main scene. The Main scene would be composed of one root node with 2 children: a Player instance node, and a Level instance node. The root node can be anything, generally a “root” type such as “Node” which is the most global type, or “Node2D” (root type of all 2D-related nodes), “Spatial” (root type of all 3D-related nodes) or “Control” (root type of all GUI-related nodes).

As you can see, every scene is organized as a tree. The same goes for nodes’ properties: you don’t add a collision component to a node to make it collidable like Unity does. Instead, you make this node a child of a new specific node that has collision properties. Godot features various collision types nodes, depending on the usage (see the Physics introduction).

  • What are the advantages of this system? Wouldn’t this system potentially increase the depth of the scene tree? And doesn’t Unity already allow you to organize GameObjects by putting them inside empty GameObjects?

    • Godot’s system is closer to the well-known object-oriented paradigm: Godot provides a number of nodes which are not clearly “Game Objects”, but they provide their children with their own capabilities: this is inheritance.
    • Godot allows the extraction of a subtree of a scene to make it a scene of its own. So if a scene tree gets too deep, it can be split into smaller subtrees. This is better for reusability, as you can include any subtree as a child of any node. Putting multiple GameObjects in an empty GameObject in Unity does not provide the same functionality.

Organização do projeto


There is no perfect project architecture. Any architecture can be made to work in either Unity and Godot.

However, a common architecture for Unity projects is to have one Assets folder in the root directory that contains various folders, one per type of asset: Audio, Graphics, Models, Materials, Scripts, Scenes, and so on.

Since Godot allows splitting scenes into smaller scenes, each scene and subscene existing as a file in the project, we recommend organizing your project a bit differently. This wiki provides a page for this: Organização do projeto.

Onde estão meus prefabs?

A prefab as provided by Unity is a ‘template’ element of the scene. It is reusable, and each instance of the prefab that exists in the scene has an existence of its own, but all of them have the same properties as defined by the prefab.

Godot does not provide prefabs as such, but the same functionality is provided by its scene system: The scene system is organized as a tree. Godot allows you to save any subtree of a scene as a scene file. This new scene can then be instanced as many times as you want, as a child of any node. Any change you make to this new, separate scene will be applied to its instances. However, any change you make to the instance will not have any impact on the ‘template’ scene.


To be precise, you can modify the parameters of an instance in the Inspector panel. The nodes that compose this instance are initially locked. You can unlock them if you need to by right-clicking the instance in the Scene tree and selecting “Editable children” in the menu. You don’t need to do this to add new child nodes to this node. Remember that any new children will belong to the instance, not to the ‘template’ scene on disk. If you want to add new children to every instance of your ‘template’ scene, then you should add them in the ‘template’ scene.


Correspondência do glossário

  • GameObject -> Nó
  • Adicionar um componente -> Herdar
  • Prefab -> Arquivo de cena reutilizável

Scripting: GDScript, C # e Visual Script


Unity supports C#. C# benefits from its integration with Visual Studio and has desirable features such as static typing.

Godot provides its own scripting language, GDScript as well as support for Visual Script and C#. GDScript borrows its syntax from Python, but is not related to it. If you wonder about the reasoning for a custom scripting language, please read the GDScript basics and Perguntas Frequentes pages. GDScript is strongly attached to the Godot API and doesn’t take long to learn: Between one evening for an experienced programmer and a week for a complete beginner.

Unity permite que você anexe quantos scripts quiser a um GameObject. Cada script adiciona um comportamento ao GameObject: Por exemplo, você pode anexar um script para que ele reaja aos controles do player e outro que controle sua lógica de jogo específica.

Em Godot, você só pode anexar um script por nó. Você pode usar um arquivo GDScript externo ou incluir o script diretamente no nó. Se você precisar anexar mais scripts a um nó, considere duas soluções, dependendo da cena e do que deseja alcançar:

  • adicione um novo nó entre o nó de destino e seu pai atual e adicione um script a esse novo nó.
  • or, you can split your target node into multiple children and attach one script to each of them.

As you can see, it can be easy to turn a scene tree to a mess. Consider splitting any complicated scene into multiple, smaller branches.

Conexões: grupos e sinais

You can control nodes by accessing them via script and calling built-in or user-defined functions on them. You can also place nodes in a group and call functions on all nodes in this group. See more in the scripting documentation.

Nodes can send a signal when a specified action occurs. A signal can be set to call any function. You can define custom signals and specify when they are triggered. See more in the signals documentation.

Script serialization

O Unity pode manipular a serialização de scripts de duas maneiras:

  • Implícito: Todos os campos públicos em uma classe são automaticamente serializados se o tipo for serializável (Dicionário não é serializável).
  • Explicito: Campos não públicos podem ser serializados usando o atributo ``[SerializarCampo] ``.

Godot também possui um sistema de serialização de scripts embutido, mas funciona apenas explicitamente. Você pode serializar qualquer tipo serializável (: ref: built-in e vários tipos de mecanismos <doc_binary_serialization_api>, incluindo: ref: class_Array e: ref:` class_dictionary`) usando a palavra-chave `` export``. Veja a: ref: documentação de exportações <doc_gdscript_exports> para detalhes.

Unity também tem um tipo de dados chamado `` ScriptableObject`` usado para serializar objetos de ativos personalizados. Seu equivalente em Godot é a classe base para todos os recursos:: ref: class_Resource. Criar um script que herda: ref: class_Resource permitirá que você crie objetos serializáveis personalizados. Mais informações sobre recursos podem ser encontradas: ref: here <doc_resources>.

Usando Godot com C ++

Godot allows you to develop your project directly in C++ by using its API, which is not possible with Unity at the moment. As an example, you can consider Godot Engine’s editor as a “game” written in C++ using the Godot API.

Se você estiver interessado em usar Godot com C ++, você pode querer começar a ler a página: ref: Desenvolvendo em C ++ <doc_introduction_to_godot_development>.