Browse Source

Add a note to set default values for custom resources (#4650)

Co-authored-by: Hugo Locurcio <[email protected]>
RoniPerson 4 years ago
parent
commit
b1bf4a93e3
1 changed files with 6 additions and 0 deletions
  1. 6 0
      tutorials/scripting/resources.rst

+ 6 - 0
tutorials/scripting/resources.rst

@@ -206,6 +206,9 @@ Let's see some examples.
     export(Resource) var sub_resource
     export(Resource) var sub_resource
     export(Array, String) var strings
     export(Array, String) var strings
 
 
+    # Make sure that every parameter has a default value. 
+    # Otherwise, there will be problems with creating and editing
+    # your resource via the inspector.
     func _init(p_health = 0, p_sub_resource = null, p_strings = []):
     func _init(p_health = 0, p_sub_resource = null, p_strings = []):
         health = p_health
         health = p_health
         sub_resource = p_sub_resource
         sub_resource = p_sub_resource
@@ -238,6 +241,9 @@ Let's see some examples.
                 [Export]
                 [Export]
                 public String[] Strings { get; set; }
                 public String[] Strings { get; set; }
 
 
+                // Make sure that every parameter has a default value. 
+                // Otherwise, there will be problems with creating and editing
+                // your resource via the inspector.
                 public BotStats(int health = 0, Resource subResource = null, String[] strings = null)
                 public BotStats(int health = 0, Resource subResource = null, String[] strings = null)
                 {
                 {
                     Health = health;
                     Health = health;