Godot 3.2 is an exciting new launch with many new features. I did encounter a little issue with my current project when switching to Godot 3.2 that my solution may help people out.
I wrote a finite state machine for use with my game. In this state machine, a state calls on the player controller. For some reason, the state machine is loaded before the onready commands are called in the player controller, causing any onready vars to not be prepared. To fix this, and to add a little bit of lazy programming into the player controller, I implemented the following code:
onready var kinematic_controller : KinematicBody2D = get_node("Character_Controller")var kinematic_controller : KinematicBody2D = null ... func get_kinematic_controller() -> KinematicBody2D: if kinematic_controller == null: kinematic_controller = get_node("Character_Controller") return kinematic_controller
This way, if for any reason the onready call to set a controller is not called, we can call it in the get function. I got my game from a non-running state to running perfectly again.
Leave a Reply