You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a bug. Arrays are passed by reference; they do not copy the entire content. Otherwise you would get:
vara: Array[Node2D]
varb: Array[Node]
b=a# Now `b` refers to the same array as `a`.b.append(Label.new()) # Valid, `Label` is a subtype of `Node`.print(a[0]) # Invalid, `Label` is **not** a subtype of `Node2D`.
Probably the only way this would work is if the GDScript supported read/write qualifiers. But it's too difficult.
Tested versions
Tested on Godot 4.3beta1
System information
Windows 10, Forward+
Issue description
I noticed that polymorphism doesn't work on arrays of a specific type. Example below
Steps to reproduce
Minimal reproduction project (MRP)
test.zip
The text was updated successfully, but these errors were encountered: