Browse Source

Merge pull request #1791 from williamd1k0/script-serialization

Add Script Serialization info in Unity to Godot page
Max Hilbrunner 6 years ago
parent
commit
b497654c69
1 changed files with 17 additions and 1 deletions
  1. 17 1
      getting_started/editor/unity_to_godot.rst

+ 17 - 1
getting_started/editor/unity_to_godot.rst

@@ -5,7 +5,7 @@
 ..    https://docs.unrealengine.com/latest/INT/GettingStarted/FromUnity/
 
 From Unity to Godot Engine
-============================
+==========================
 
 This guide provides an overview of Godot Engine from the viewpoint of a Unity user,
 and aims to help you migrate your existing Unity experience into the world of Godot.
@@ -239,6 +239,22 @@ You can connect these signals to call a specific function when they happen.
 Note that you can define your own signals and send them whenever you want.
 This feature is documented `here <../scripting/gdscript/gdscript_basics.html#signals>`_.
 
+Script Serialization
+^^^^^^^^^^^^^^^^^^^^
+
+Unity can handle script serialization in two ways:
+
+- Implicit: All public fields in a class are automatically serialized if the type is a serializable type (``Dictionary`` is not serializable).
+- Explicit: Non-public fields can be serialized using the ``[SerializeField]`` attribute.
+
+Godot also has a built-in script serialization system, but it works only explicitly.
+You can serialize any serializable type (:ref:`built-in and various engine types <doc_binary_serialization_api>`, including :ref:`class_Array` and :ref:`class_Dictionary`)
+using the ``export`` keyword. This workflow is explained `here <../scripting/gdscript/gdscript_basics.html#exports>`_.
+
+Unity also has a data type called ``ScriptableObject`` used to serialize custom asset objects.
+Its equivalent in Godot is the base class for all resources: :ref:`class_Resource`.
+Creating a script that inherits :ref:`class_Resource` will allow you to create custom serializable objects. More information about resources can be found :ref:`here <doc_resources>`.
+
 Using Godot in C++
 ------------------