File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
tutorials/scripting/gdscript Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1535,6 +1535,22 @@ the function name with the attribute operator::
15351535 func dont_override():
15361536 return super.overriding() # This calls the method as defined in the base class.
15371537
1538+ .. warning ::
1539+
1540+ One of the common misconceptions is trying to override *non-virtual * engine methods
1541+ such as ``get_class() ``, ``queue_free() ``, etc. This is not supported for technical reasons.
1542+
1543+ In Godot 3, you can *shadow * engine methods in GDScript, and it will work if you call this method in GDScript.
1544+ However, the engine will **not ** execute your code if the method is called inside the engine on some event.
1545+
1546+ In Godot 4, even shadowing may not always work, as GDScript optimizes native method calls.
1547+ Therefore, we added the ``NATIVE_METHOD_OVERRIDE `` warning, which is treated as an error by default.
1548+ We strongly advise against disabling or ignoring the warning.
1549+
1550+ Note that this does not apply to virtual methods such as ``_ready() ``, ``_process() `` and others
1551+ (marked with the ``virtual `` qualifier in the documentation and the names start with an underscore).
1552+ These methods are specifically for customizing engine behavior and can be overridden in GDScript.
1553+ Signals and notifications can also be useful for these purposes.
15381554
15391555Class constructor
15401556^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments