Godot Version
4.3
Question
I was trying to port a script I wrote for Unity into GDscript. I had various problems which I was working through, but I have isolated an error which I really cannot understand. Basically, accessing the global_transform of a Node3D (which itself is definitely NOT null or not being referenced correctly) with nothing else on it goes from existing to giving the error
Invalid access to property or key ‘global_transfrom’ on a base object of type ‘Node3D’.
when accessed. To reproduce this:
- Create a new project and a 3D scene that looks like this
- Create a new script and add it onto one of the Node3Ds
extends Node3D
@export var follower : Node3D
func _process(delta: float) -> void:
print(follower.global_transfrom.basis)
-
Set the value “follower” to the other node in the inspector
-
If now run, it produces the following error:
I cannot understand this at all. Furthermore, it only seems to give the error on the last line of _process, as below the first two go through without error and their outputs fine. The error only occurs on the 3rd line!
I really cannot understand why I am gettiing this error in any way at all. Can anyone explain why global_transform becomes inacessible even though there’s literally nothing else going on in this scene???