|
@@ -25,14 +25,14 @@ Global functions like ``print``, ``var2str`` and ``weakref`` are located under
|
|
Math
|
|
Math
|
|
----
|
|
----
|
|
|
|
|
|
-Math functions like ``abs``, ``acos``, ``asin``, ``atan`` and ``atan2`` are
|
|
|
|
|
|
+Math functions, like ``abs``, ``acos``, ``asin``, ``atan`` and ``atan2``, are
|
|
located under ``Mathf`` as ``Abs``, ``Acos``, ``Asin``, ``Atan`` and ``Atan2``, instead of in global scope.
|
|
located under ``Mathf`` as ``Abs``, ``Acos``, ``Asin``, ``Atan`` and ``Atan2``, instead of in global scope.
|
|
``PI`` is ``Mathf.Pi``
|
|
``PI`` is ``Mathf.Pi``
|
|
|
|
|
|
Random
|
|
Random
|
|
------
|
|
------
|
|
|
|
|
|
-Random functions like ``rand_range`` and ``rand_seed`` are located under ``Random``,
|
|
|
|
|
|
+Random functions, like ``rand_range`` and ``rand_seed``, are located under ``Random``,
|
|
so use ``Random.RandRange`` instead of ``rand_range``.
|
|
so use ``Random.RandRange`` instead of ``rand_range``.
|
|
|
|
|
|
Export keyword
|
|
Export keyword
|
|
@@ -74,14 +74,14 @@ by the ``StringExtensions`` class as extension methods. Example:
|
|
string upper = "I LIKE SALAD FORKS";
|
|
string upper = "I LIKE SALAD FORKS";
|
|
string lower = upper.ToLower();
|
|
string lower = upper.ToLower();
|
|
|
|
|
|
-There are a few differences though:
|
|
|
|
|
|
+There are a few differences, though:
|
|
|
|
|
|
* ``erase``: Strings are immutable in C#, so we cannot modify the string
|
|
* ``erase``: Strings are immutable in C#, so we cannot modify the string
|
|
- passed to the extension method. For this reason ``Erase`` was added as an
|
|
|
|
|
|
+ passed to the extension method. For this reason, ``Erase`` was added as an
|
|
extension method of ``StringBuilder`` instead of string.
|
|
extension method of ``StringBuilder`` instead of string.
|
|
- Alternatively you can use ``string.Remove``.
|
|
|
|
-* ``IsSubsequenceOf``/``IsSubsequenceOfi``: An additional method is provided
|
|
|
|
- which is an overload of ``IsSubsequenceOf`` allowing to explicitly specify
|
|
|
|
|
|
+ Alternatively, you can use ``string.Remove``.
|
|
|
|
+* ``IsSubsequenceOf``/``IsSubsequenceOfi``: An additional method is provided,
|
|
|
|
+ which is an overload of ``IsSubsequenceOf``, allowing you to explicitly specify
|
|
case sensitivity:
|
|
case sensitivity:
|
|
|
|
|
|
.. code-block:: csharp
|
|
.. code-block:: csharp
|
|
@@ -92,7 +92,7 @@ There are a few differences though:
|
|
str.IsSubsequenceOf("ok", false); // Case insensitive
|
|
str.IsSubsequenceOf("ok", false); // Case insensitive
|
|
|
|
|
|
* ``Match``/``Matchn``/``ExprMatch``: An additional method is provided besides
|
|
* ``Match``/``Matchn``/``ExprMatch``: An additional method is provided besides
|
|
- ``Match`` and ``Matchn``, which allows to explicitly specify case sensitivity:
|
|
|
|
|
|
+ ``Match`` and ``Matchn``, which allows you to explicitly specify case sensitivity:
|
|
|
|
|
|
.. code-block:: csharp
|
|
.. code-block:: csharp
|
|
|
|
|
|
@@ -104,11 +104,11 @@ There are a few differences though:
|
|
Basis
|
|
Basis
|
|
-----
|
|
-----
|
|
|
|
|
|
-Structs cannot have parameterless constructors in C#, therefore ``new Basis()``
|
|
|
|
|
|
+Structs cannot have parameterless constructors in C#. Therefore, ``new Basis()``
|
|
initializes all primitive members to their default value. Use ``Basis.Identity``
|
|
initializes all primitive members to their default value. Use ``Basis.Identity``
|
|
-for the equivalent to ``Basis()`` in GDScript and C++.
|
|
|
|
|
|
+for the equivalent of ``Basis()`` in GDScript and C++.
|
|
|
|
|
|
-The following methods were converted to properties with their respective names changed:
|
|
|
|
|
|
+The following method was converted to a property with a different name:
|
|
|
|
|
|
================ ==================================================================
|
|
================ ==================================================================
|
|
GDScript C#
|
|
GDScript C#
|
|
@@ -119,9 +119,9 @@ get_scale() Scale
|
|
Transform2D
|
|
Transform2D
|
|
-----------
|
|
-----------
|
|
|
|
|
|
-Structs cannot have parameterless constructors in C#, therefore ``new Transform2D()``
|
|
|
|
|
|
+Structs cannot have parameterless constructors in C#. Therefore, ``new Transform2D()``
|
|
initializes all primitive members to their default value.
|
|
initializes all primitive members to their default value.
|
|
-Please use ``Transform2D.Identity`` for the equivalent to ``Transform2D()`` in GDScript and C++.
|
|
|
|
|
|
+Please use ``Transform2D.Identity`` for the equivalent of ``Transform2D()`` in GDScript and C++.
|
|
|
|
|
|
The following methods were converted to properties with their respective names changed:
|
|
The following methods were converted to properties with their respective names changed:
|
|
|
|
|
|
@@ -136,7 +136,7 @@ get_scale() Scale
|
|
Plane
|
|
Plane
|
|
-----
|
|
-----
|
|
|
|
|
|
-The following methods were converted to properties with their respective names changed:
|
|
|
|
|
|
+The following method was converted to a property with a *slightly* different name:
|
|
|
|
|
|
================ ==================================================================
|
|
================ ==================================================================
|
|
GDScript C#
|
|
GDScript C#
|
|
@@ -147,7 +147,7 @@ center() Center
|
|
Rect2
|
|
Rect2
|
|
-----
|
|
-----
|
|
|
|
|
|
-The following fields were converted to properties with their respective names changed:
|
|
|
|
|
|
+The following field was converted to a property with a *slightly* different name:
|
|
|
|
|
|
================ ==================================================================
|
|
================ ==================================================================
|
|
GDScript C#
|
|
GDScript C#
|
|
@@ -155,7 +155,7 @@ GDScript C#
|
|
end End
|
|
end End
|
|
================ ==================================================================
|
|
================ ==================================================================
|
|
|
|
|
|
-The following methods were converted to properties with their respective names changed:
|
|
|
|
|
|
+The following method was converted to a property with a different name:
|
|
|
|
|
|
================ ==================================================================
|
|
================ ==================================================================
|
|
GDScript C#
|
|
GDScript C#
|
|
@@ -166,9 +166,9 @@ get_area() Area
|
|
Quat
|
|
Quat
|
|
----
|
|
----
|
|
|
|
|
|
-Structs cannot have parameterless constructors in C#, therefore ``new Quat()``
|
|
|
|
|
|
+Structs cannot have parameterless constructors in C#. Therefore, ``new Quat()``
|
|
initializes all primitive members to their default value.
|
|
initializes all primitive members to their default value.
|
|
-Please use ``Quat.Identity`` for the equivalent to ``Quat()`` in GDScript and C++.
|
|
|
|
|
|
+Please use ``Quat.Identity`` for the equivalent of ``Quat()`` in GDScript and C++.
|
|
|
|
|
|
Array
|
|
Array
|
|
-----
|
|
-----
|
|
@@ -189,7 +189,7 @@ PoolVector2Array Vector2[]
|
|
PoolVector3Array Vector3[]
|
|
PoolVector3Array Vector3[]
|
|
================ ==================================================================
|
|
================ ==================================================================
|
|
|
|
|
|
-In some exceptional cases a raw array (``type[]``) may be required instead of a ``List``.
|
|
|
|
|
|
+In some exceptional cases, a raw array (``type[]``) may be required instead of a ``List``.
|
|
|
|
|
|
Dictionary
|
|
Dictionary
|
|
----------
|
|
----------
|
|
@@ -201,7 +201,7 @@ Use ``Dictionary<object, object>``.
|
|
Variant
|
|
Variant
|
|
-------
|
|
-------
|
|
|
|
|
|
-``System.Object`` (``object``) is used in place of ``Variant``.
|
|
|
|
|
|
+``System.Object`` (``object``) is used instead of ``Variant``.
|
|
|
|
|
|
Communicating with other scripting languages
|
|
Communicating with other scripting languages
|
|
--------------------------------------------
|
|
--------------------------------------------
|
|
@@ -214,7 +214,7 @@ scripting languages via the Variant API.
|
|
Other differences
|
|
Other differences
|
|
-----------------
|
|
-----------------
|
|
|
|
|
|
-``preload``, ``assert`` and ``yield`` as they work in GDScript are currently
|
|
|
|
|
|
+``preload``, ``assert`` and ``yield``, as they work in GDScript, are currently
|
|
not available in C#.
|
|
not available in C#.
|
|
|
|
|
|
Other differences:
|
|
Other differences:
|
|
@@ -227,5 +227,5 @@ is_inf float.IsInfinity
|
|
is_nan float.IsNaN
|
|
is_nan float.IsNaN
|
|
dict2inst ? TODO
|
|
dict2inst ? TODO
|
|
inst2dict ? TODO
|
|
inst2dict ? TODO
|
|
-load GD.load which is the same as ResourceLoader.load
|
|
|
|
|
|
+load GD.load, which is the same as ResourceLoader.load
|
|
================ ==================================================================
|
|
================ ==================================================================
|