Needing help with this (2)

Godot Version

4.7.2

Question

just solved fixed the raycast problem by the users, but got this



@export var state_machine : charstatemachine

func _process(_delta):
	text = "state:" + state_machine.current_state.name
	
	

The error is telling you everything you need to know.

Invalid access to property or key ā€˜current_state’

So it could not find current_state which you reference here:

state_machine.current_state.name

Why? Well the error message tells you.

… on a base object of type ā€˜Nil’.

So it is telling you it can’t find ā€˜current_state’ on your state_machine because state_machine is not set.

ā€œBut I set it hereā€ I hear you say.

@export var state_machine : charstatemachine

But the engine is telling you this is not set. So did you actually set it in the export var in the inspector? If so then this class may be incorrect, having typos or errors of its own and could not be loaded.

Very often this is a misspelled class name, or errors in your class, or perhaps you just forgot to actually set the export var in the inspector.

there might be a chance that you also define the ā€œcharstatemachineā€ but not save the updated file so the engine gives you this error. that happen with me a lot.

But if this is not the problem can you share this file code ā€œcharstatemachineā€, so we can better help you with it.

@Mark_Caliwa_Velasco when creating new topics, please make sure to use a meaningful Title, otherwise it’s hard to differentiate between these.

I’d appreciate if you edited these 2 topics and added an appropriate Title, thank you.

Additionally, I suggest to check Posting guidelines in #Help channel.