From 1430ddfff50d37c528317f2d22e11cde4eaa22bc Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Tue, 6 Oct 2020 15:04:53 -0400 Subject: [PATCH] Document how struct "constants" aren't really constants in C# --- getting_started/scripting/c_sharp/c_sharp_differences.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/getting_started/scripting/c_sharp/c_sharp_differences.rst b/getting_started/scripting/c_sharp/c_sharp_differences.rst index 7aa186162..3df8b3c5f 100644 --- a/getting_started/scripting/c_sharp/c_sharp_differences.rst +++ b/getting_started/scripting/c_sharp/c_sharp_differences.rst @@ -21,7 +21,12 @@ Most global constants were moved to their own enums. Constants ^^^^^^^^^ -Global constants were moved to their own enums. +In C#, only primitive types can be constant. For example, the ``TAU`` constant +is replaced by the ``Mathf.Tau`` constant, but the ``Vector2.RIGHT`` constant +is replaced by the ``Vector2.Right`` read-only property. This behaves similarly +to a constant, but can't be used in some contexts like ``switch`` statements. + +Global enum constants were moved to their own enums. For example, ``ERR_*`` constants were moved to the ``Error`` enum. Special cases: