Skip to content

Commit 07cb95a

Browse files
authored
Merge pull request godotengine#8853 from 31/dev/31/clean-export-cs
c_sharp_exports.rst: fix private naming style; minor grammar
2 parents 8334647 + b3b15a6 commit 07cb95a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

tutorials/scripting/c_sharp/c_sharp_exports.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Exporting is done by using the ``[Export]`` attribute.
1515
public partial class ExportExample : Node3D
1616
{
1717
[Export]
18-
private int Number = 5;
18+
public int Number { get; set; } = 5;
1919
}
2020
2121
In that example the value ``5`` will be saved, and after building the current project
@@ -36,7 +36,7 @@ Exporting can only be done with :ref:`Variant-compatible <doc_c_sharp_variant>`
3636
Basic use
3737
---------
3838

39-
Exporting can work with fields and properties.
39+
Exporting works with fields and properties. They can have any access modifier.
4040

4141
.. code-block:: csharp
4242
@@ -54,10 +54,10 @@ because ``string`` is a reference type.
5454
.. code-block:: csharp
5555
5656
[Export]
57-
private int _number;
57+
public int Number { get; set; }
5858
5959
[Export]
60-
private string _text;
60+
public string Text { get; set; }
6161
6262
Default values can be specified for fields and properties.
6363

@@ -132,7 +132,7 @@ list with the ``[ExportCategory]`` attribute.
132132
133133
[ExportCategory("Extra Category")]
134134
[Export]
135-
private bool Flag { get; set; } = false;
135+
public bool Flag { get; set; } = false;
136136
137137
.. note::
138138

@@ -245,14 +245,14 @@ Regular color given as red-green-blue-alpha value.
245245
.. code-block:: csharp
246246
247247
[Export]
248-
private Color Color { get; set; }
248+
public Color Color { get; set; }
249249
250250
Color given as red-green-blue value (alpha will always be 1).
251251

252252
.. code-block:: csharp
253253
254254
[Export(PropertyHint.ColorNoAlpha)]
255-
private Color Color { get; set; }
255+
public Color Color { get; set; }
256256
257257
.. _doc_c_sharp_exports_nodes:
258258

@@ -273,11 +273,11 @@ Exporting NodePaths like in Godot 3.x is still possible, in case you need it:
273273
.. code-block:: csharp
274274
275275
[Export]
276-
private NodePath _nodePath;
276+
public NodePath NodePath { get; set; }
277277
278278
public override void _Ready()
279279
{
280-
var node = GetNode(_nodePath);
280+
var node = GetNode(NodePath);
281281
}
282282
283283
Resources
@@ -286,7 +286,7 @@ Resources
286286
.. code-block:: csharp
287287
288288
[Export]
289-
private Resource Resource;
289+
public Resource Resource { get; set; }
290290
291291
In the Inspector, you can then drag and drop a resource file
292292
from the FileSystem dock into the variable slot.
@@ -298,7 +298,7 @@ Therefore, if you specify a type derived from Resource such as:
298298
.. code-block:: csharp
299299
300300
[Export]
301-
private AnimationNode Resource;
301+
public AnimationNode AnimationNode { get; set; }
302302
303303
The drop-down menu will be limited to AnimationNode and all
304304
its inherited classes. Custom resource classes can also be used,
@@ -447,16 +447,16 @@ Exporting Godot arrays
447447
[Export]
448448
public Godot.Collections.Array Array { get; set; }
449449
450-
Using the generic ``Godot.Collections.Array<T>`` allows to specify the type of the
451-
array elements which will be used as a hint for the editor. The Inspector will
450+
Using the generic ``Godot.Collections.Array<T>`` allows specifying the type of the
451+
array elements, which will be used as a hint for the editor. The Inspector will
452452
restrict the elements to the specified type.
453453

454454
.. code-block:: csharp
455455
456456
[Export]
457457
public Godot.Collections.Array<string> Array { get; set; }
458458
459-
The default value of Godot arrays is null, a different default can be specified:
459+
The default value of Godot arrays is null. A different default can be specified:
460460

461461
.. code-block:: csharp
462462
@@ -487,8 +487,8 @@ Exporting Godot dictionaries
487487
[Export]
488488
public Godot.Collections.Dictionary Dictionary { get; set; }
489489
490-
Using the generic ``Godot.Collections.Dictionary<TKey, TValue>`` allows to specify
491-
the type of the key and value elements of the dictionary.
490+
Using the generic ``Godot.Collections.Dictionary<TKey, TValue>`` allows specifying
491+
the types of the key and value elements of the dictionary.
492492

493493
.. note::
494494

@@ -501,7 +501,7 @@ the type of the key and value elements of the dictionary.
501501
[Export]
502502
public Godot.Collections.Dictionary<string, int> Dictionary { get; set; }
503503
504-
The default value of Godot dictionaries is null, a different default can be specified:
504+
The default value of Godot dictionaries is null. A different default can be specified:
505505

506506
.. code-block:: csharp
507507
@@ -526,7 +526,7 @@ C# arrays can exported as long as the element type is a :ref:`Variant-compatible
526526
[Export]
527527
public NodePath[] NodePaths { get; set; }
528528
529-
The default value of C# arrays is null, a different default can be specified:
529+
The default value of C# arrays is null. A different default can be specified:
530530

531531
.. code-block:: csharp
532532

0 commit comments

Comments
 (0)