فهرست منبع

Document using PropertyHint with [Export]

Kelly Thomas 5 سال پیش
والد
کامیت
babcca5b28
1فایلهای تغییر یافته به همراه12 افزوده شده و 1 حذف شده
  1. 12 1
      getting_started/scripting/c_sharp/c_sharp_differences.rst

+ 12 - 1
getting_started/scripting/c_sharp/c_sharp_differences.rst

@@ -86,6 +86,8 @@ Export keyword
 --------------
 
 Use the ``[Export]`` attribute instead of the GDScript ``export`` keyword.
+This attribute can also be provided with optional :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` and ``hintString`` parameters.
+Default values can be set by assigning a value.
 
 Example:
 
@@ -96,7 +98,16 @@ Example:
     public class MyNode : Node
     {
         [Export]
-        NodePath _nodePath;
+        private NodePath _nodePath;
+
+        [Export]
+        private string _name = "default";
+
+        [Export(PropertyHint.Range, "0,100000,1000,or_greater")]
+        private int _income;
+
+        [Export(PropertyHint.File, "*.png,*.jpg")]
+        private string _icon;
     }
 
 Signal keyword