StayAtHomeDev-Git/FPS-Godot-Basic-Setup

"CAMERA_CONTROLLER" causing Error

Opened this issue · 1 comments

Following your tutorial ( nice one btw ), i quicklly run into a issue with the CAMERA_CONTROLLER.transform.basis at line 42 that returned 'Nil'...

After 30minutes of testing turn out inside of godot 4.2.1 stable '@export var CAMERA_CONTROLLER : Camera3D' does not work, why? idk ㄟ( ▔, ▔ )ㄏ

My Solutions:

func _ready():
    CAMERA_CONTROLLER = $CameraController/Camera
    if not CAMERA_CONTROLLER:
        print("Error: CAMERA_CONTROLLER is not assigned correctly.")

Or:

@onready var CAMERA_CONTROLLER = $CameraController/Camera

hope that can help somebody ^^

yes, thank you. the part that my eyes didn't catch at first was the switch to @onready.