Instantiate does not work for me

when i try to do as the tutorial says enemy_scene.instantiate() it doesnt work is says "invalid call. Nonexistent function “instantiate” in base "GDscript

nevermind it helped closing Godot and opening the project again, any idea why, i also whenever i type insta for example it never gives me a suggestion to use the instantiate() line

Hi Alex,

I’m not sure why it initially gave you an error there but maybe i can clarify a couple of things.
Instantiate is a method of a PackedScene which is the scene “enemy.tscn” that we are preloading in this script, If for some reason there is an issue with that then it cannot access that and so it wont be able to access the Instantiate method.
This would also stop the auto complete from working.

Again i am not sure why Godot gave you an error maybe it was a weird glitch that we may never know.

Hope this gives some clarity though.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms