Godot Version
4.2.2
Question
Getting error “Attempt to call function ‘play’ in base ‘null instance’ on a null instance” I’ve checked the parenting in both local and remote and everything looks great, screenshot attached:
4.2.2
Getting error “Attempt to call function ‘play’ in base ‘null instance’ on a null instance” I’ve checked the parenting in both local and remote and everything looks great, screenshot attached:
the only thing you can do for this to add delay on _ready() call
try add:
await get_tree().physics_frame
on the first line of _ready() function
I added that line right after _ready() and I’m getting the same error sadly.
how about you add it like this:
await get_tree().create_timer(5).timeout
will it still show the same error at the same line ?
try @export var
instead
i see you done that on for basic Variants, you can also do that for Nodes
just do like
@export var _animation_player:AnimationPlayer
replace the @onready var you already have
then assign the badplayer AnimationPlayer via inspector dock
run the game, if it still error then
do you have an error in the Enemy Script? copy and paste the code to here
use this for better readable code:
it does feel like your Enemy.gd has an error, so it doesnt recognize this script
Did you manage to fix it? I have the same error in a very simple code and I don’t know why it’s happening.
Could it be the line above causing a problem?
The child nodes are ready before their parents are complete so is get_parent()
actually working in the child _ready()
function?