Ver código fonte

Mention the lack of support for cross-language script inheritance

See https://github.com/godotengine/godot/issues/38352.
Hugo Locurcio 5 anos atrás
pai
commit
a492d292b9
1 arquivos alterados com 20 adições e 11 exclusões
  1. 20 11
      getting_started/scripting/cross_language_scripting.rst

+ 20 - 11
getting_started/scripting/cross_language_scripting.rst

@@ -72,7 +72,7 @@ Instantiating C# nodes from GDScript
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
 Using C# from GDScript doesn't need much work. Once loaded
 Using C# from GDScript doesn't need much work. Once loaded
-(see :ref:`doc_gdscript_classes_as_resources`) the script can be instantiated
+(see :ref:`doc_gdscript_classes_as_resources`), the script can be instantiated
 with :ref:`new() <class_CSharpScript_method_new>`.
 with :ref:`new() <class_CSharpScript_method_new>`.
 
 
 ::
 ::
@@ -83,15 +83,15 @@ with :ref:`new() <class_CSharpScript_method_new>`.
 
 
 .. warning::
 .. warning::
 
 
-    When creating .cs scripts you should always keep in mind that the class
-    Godot will use is the one named like the .cs file itself. If that class
+    When creating ``.cs`` scripts, you should always keep in mind that the class
+    Godot will use is the one named like the ``.cs`` file itself. If that class
     does not exist in the file, you'll see the following error:
     does not exist in the file, you'll see the following error:
     ``Invalid call. Nonexistent function `new` in base``.
     ``Invalid call. Nonexistent function `new` in base``.
 
 
     For example, MyCoolNode.cs should contain a class named MyCoolNode.
     For example, MyCoolNode.cs should contain a class named MyCoolNode.
 
 
-    You also need to check your .cs file is referenced in the project's .csproj
-    file. Otherwise, the same error will occur.
+    You also need to check your ``.cs`` file is referenced in the project's
+    ``.csproj`` file. Otherwise, the same error will occur.
 
 
 Instantiating GDScript nodes from C#
 Instantiating GDScript nodes from C#
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -104,7 +104,7 @@ be instantiated with :ref:`GDScript.New() <class_GDScript_method_new>`.
     GDScript MyGDScript = (GDScript) GD.Load("res://path_to_gd_file.gd");
     GDScript MyGDScript = (GDScript) GD.Load("res://path_to_gd_file.gd");
     Object myGDScriptNode = (Godot.Object) MyGDScript.New(); // This is a Godot.Object
     Object myGDScriptNode = (Godot.Object) MyGDScript.New(); // This is a Godot.Object
 
 
-Here we are using an :ref:`class_Object` but you can use type conversion like
+Here we are using an :ref:`class_Object`, but you can use type conversion like
 explained in :ref:`doc_c_sharp_features_type_conversion_and_casting`.
 explained in :ref:`doc_c_sharp_features_type_conversion_and_casting`.
 
 
 Accessing fields
 Accessing fields
@@ -126,8 +126,8 @@ anything to worry about.
     # my_csharp_node.str2 = "BARBAR" # This line will hang and crash
     # my_csharp_node.str2 = "BARBAR" # This line will hang and crash
 
 
 Note that it doesn't matter if the field is defined as a property or an
 Note that it doesn't matter if the field is defined as a property or an
-attribute, but trying to set a value on a property that does not define a
-setter will result in a crash.
+attribute. However, trying to set a value on a property that does not define
+a setter will result in a crash.
 
 
 Accessing GDScript fields from C#
 Accessing GDScript fields from C#
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -158,7 +158,7 @@ Calling C# methods from GDScript
 Again, calling C# methods from GDScript should be straightforward. The
 Again, calling C# methods from GDScript should be straightforward. The
 marshalling process will do its best to cast your the arguments to match
 marshalling process will do its best to cast your the arguments to match
 function signatures.
 function signatures.
-If that's impossible you'll see the following error: ``Invalid call. Nonexistent function `FunctionName```.
+If that's impossible, you'll see the following error: ``Invalid call. Nonexistent function `FunctionName```.
 
 
 ::
 ::
 
 
@@ -174,7 +174,7 @@ Calling GDScript methods from C#
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
 To call GDScript methods from C# you'll need to use
 To call GDScript methods from C# you'll need to use
-:ref:`Object.Call() <class_Object_method_call>`. The first arguments is the
+:ref:`Object.Call() <class_Object_method_call>`. The first argument is the
 name of the method you want to call. The following arguments will be passed
 name of the method you want to call. The following arguments will be passed
 to said method.
 to said method.
 
 
@@ -197,5 +197,14 @@ to said method.
 
 
     As you can see, if the first argument of the called method is an array,
     As you can see, if the first argument of the called method is an array,
     you'll need to cast it as ``object``.
     you'll need to cast it as ``object``.
-    Otherwise each element of your array will be treated as a single argument
+    Otherwise, each element of your array will be treated as a single argument
     and the function signature won't match.
     and the function signature won't match.
+
+Inheritance
+-----------
+
+A GDScript file may not inherit from a C# script. Likewise, a C# script may not
+inherit from a GDScript file. Due to how complex this would be to implement,
+this limitation is unlikely to be lifted in the future. See
+`this GitHub issue <https://github.com/godotengine/godot/issues/38352>`__
+for more information.