godot-docs
godot-docs copied to clipboard
Add page about Godot 3.x -> Godot 4 guidelines
Few advices which could be added to this page
- Don't use
if "string"orif [], since Godot 4 not supports this
var str = "str"
if not str:
pass
should become
var str = "str"
if not str.is_empty():
pass
- Try to use builtin project converter multiple times, to check what not works in Godot 4 and what needs to be changed in Godot 3.x to simplify later conversions(this will also help to unify codebase between Godot 3 and Godot 4)
- Use SceneTreeTween instead Tween - In Godot 4 old tween class is removed and SceneTreeTween becomes Tween
- Some Control methods in 3.x are available in Godot 4 under Window class which not inherits from Control which may require to change a lot of code(not sure if there is any workaround for this)
- Wrap some functions which returns String, with String():
var translation_key: String = name.to_lower()
works fine in Godot 3, but cause this problem in Godot 4
Cannot find property "to_lower" on base "StringName"
to fix problem just wrap name.to_lower
String(name.to_lower())
godot issue - https://github.com/godotengine/godot/issues/64171