I got error nonexistent function "instance" in base 'Packedscene'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Landro974

Hi really thank you for your answer but I get the error I put in the title, here my code :

{ var nodeSelf = load(“res://Plants/Fruit1.tscn”).instance()

func _on_timer_timeout():
if mating == true :
mating = false
m_water -= 1

1 Like
:bust_in_silhouette: Reply From: jgodfrey

In Godot 3.x, the PackedScene class had an instance() method. However, in Godot 4.x, the method name is now instantiate(). Based on your error, I assume you’re using Godot 4.

See the docs here:

1 Like