Skip to content

Commit 31ac1bc

Browse files
committed
C#: Document new version defines and remove mentions of old defines
1 parent 45c4250 commit 31ac1bc

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

tutorials/scripting/c_sharp/c_sharp_features.rst

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,20 @@ Or you can detect which engine your code is in, useful for making cross-engine l
141141
#endif
142142
}
143143
144+
Or you can write scripts that target multiple Godot versions and can take
145+
advantage that are only available on some of those versions:
146+
147+
.. code-block:: csharp
148+
149+
public void UseCoolFeature()
150+
{
151+
#if GODOT4_3_OR_GREATER || GODOT4_2_2_OR_GREATER
152+
// Use CoolFeature, that was added to Godot in 4.3 and cherry-picked into 4.2.2, here.
153+
#else
154+
// Use a workaround for the absence of CoolFeature here.
155+
#endif
156+
}
157+
144158
Full list of defines
145159
~~~~~~~~~~~~~~~~~~~~
146160

@@ -159,15 +173,30 @@ Full list of defines
159173
:ref:`OS <class_OS>` singleton, but not every possible OS
160174
the method returns is an OS that Godot with .NET runs on.
161175

162-
When **exporting**, the following may also be defined depending on the export features:
176+
* ``GODOTX``, ``GODOTX_Y``, ``GODOTX_Y_Z``, ``GODOTx_OR_GREATER``,
177+
``GODOTX_y_OR_GREATER``, and ``GODOTX_Y_z_OR_GREATER``, where ``X``, ``Y``,
178+
and ``Z`` are replaced by the current major, minor and patch version of Godot.
179+
``x``, ``y``, and ``z`` are replaced by 0 to to the current version for that
180+
component.
163181

164-
* One of ``GODOT_PC``, ``GODOT_MOBILE``, or ``GODOT_WEB`` depending on the platform type.
182+
.. note::
183+
184+
These defines were first added in Godot 4.0.4 and 4.1. Version defines for
185+
prior versions do not exist, regardless of the current Godot version.
165186

166-
* One of ``GODOT_ARM64_V8A`` or ``GODOT_ARMEABI_V7A`` on Android only depending on the architecture.
187+
For example: Godot 4.0.5 defines ``GODOT4``, ``GODOT4_OR_GREATER``,
188+
``GODOT4_0``, ``GODOT4_0_OR_GREATER``, ``GODOT4_0_5``,
189+
``GODOT4_0_4_OR_GREATER``, and ``GODOT4_0_5_OR_GREATER``. Godot 4.3.2 defines
190+
``GODOT4``, ``GODOT4_OR_GREATER``, ``GODOT4_3``, ``GODOT4_0_OR_GREATER``,
191+
``GODOT4_1_OR_GREATER``, ``GODOT4_2_OR_GREATER``, ``GODOT4_3_OR_GREATER``,
192+
``GODOT4_3_2``, ``GODOT4_3_0_OR_GREATER``, ``GODOT4_3_1_OR_GREATER``, and
193+
``GODOT4_3_2_OR_GREATER``.
167194

168-
* One of ``GODOT_ARM64`` or ``GODOT_ARMV7`` on iOS only depending on the architecture.
195+
When **exporting**, the following may also be defined depending on the export features:
196+
197+
* One of ``GODOT_PC``, ``GODOT_MOBILE``, or ``GODOT_WEB`` depending on the platform type.
169198

170-
* Any of ``GODOT_S3TC``, ``GODOT_ETC``, and ``GODOT_ETC2`` depending on the texture compression type.
199+
* One of ``GODOT_WINDOWS``, ``GODOT_LINUXBSD``, ``GODOT_MACOS``, ``GODOT_UWP``, ``GODOT_HAIKU``, ``GODOT_ANDROID``, ``GODOT_IOS``, or ``GODOT_WEB`` depending on the platform.
171200

172201
To see an example project, see the OS testing demo:
173202
https://github.com/godotengine/godot-demo-projects/tree/master/misc/os_test

0 commit comments

Comments
 (0)