godotengine / godot-demo-projects

Demonstration and Template Projects
https://godotengine.org
MIT License
5.44k stars 1.52k forks source link

Array to Array[float] conversion no longer works. #1079

Closed BastiaanOlij closed 1 week ago

BastiaanOlij commented 1 week ago

Tested versions

System information

Windows 10

Issue description

Both movement demos in https://github.com/godotengine/godot-demo-projects/tree/master/xr have the code var available_rates: Array[float] = xr_interface.get_available_display_refresh_rates() in start_vr.gd which was working fine up until beta 1.

It now gives the error Trying to assign an array of type "Array" to a variable of type "Array[float]".

Steps to reproduce

Open one of the two openxr movement demos Open the start_vr.gd script

No need to run the project, the error is given right away.

Minimal reproduction project (MRP)

https://github.com/godotengine/godot-demo-projects/tree/master/xr/openxr_character_centric_movement

AThousandShips commented 1 week ago

This is a current limitation, see:

You need to use assign to deal with this currently

BastiaanOlij commented 1 week ago

Thanks! Interesting that it used to work fine.

AThousandShips commented 1 week ago

Are you sure? The demo was only changed to use static typing recently, and the array limitations are far older than that

It does indeed seem that this is a fault of the demo code, it's incorrect as the method called returns and Array not an Array[float], see here, the fix is to fix the demo code

AThousandShips commented 1 week ago

Transferred here as this is a (current) issue in the demo code being incorrect and the static type should be Array, as the return type is such

It'd be possible to change the return type eventually in the engine but it'd break compatibility given the limitations currently I'd say