Why don't I get autocompletion for scene.instantiate()

If I follow the tutorial here, instantiate is not one of the suggested methods to call on the Resource returned by load/preload. Similarly, trying to set the instances global_position also does not give me the hint that this variable in fact HAS a global_position. Has the way to instantiate scenes changed or anything? It still seems to work, I am just curious why this is the case.

1 Like

instantiate should come up if the resource being loaded is say a packedscene or a scene that is instancable (if thats a word)

not sure what the code completion isnt coming up.

i sometimes have to force it with Ctrl + Space to bring up the autocomplete.
but if i have any red lines, it just doesnt come up.

I had the same issue. The instructors are using Godot 3, not Godot 4.

Rather than load("res://pathto/file.tscn") try preload("res://pathto/file.tscn"). That makes instantiate come up as an option for me.

I’m not using Godot 3 my friend, take a look at the bottom right side of the engine to see the version I’m using.

If you load a .tscn file with “load” it will return a PackedScene resource. And you can call instantiate on that just fine. I checked and autocomplete doesn’t show instantiate for some reason, seems like a bug. But nevertheless you can still call instantiate no problem. You don’t have to switch from “load” to “preload”.

“load” and “preload” are two seperate functions, they work differently and have different use cases. “preload” tries to load the Resource beforehand, whereas “load” loads it when you ask for it while the game is running.


For the original question: You call instantiate on a PackedScene to create a new instance of that scene. global_position is what you set to change the global position of the node. Sorry but I don’t understand the question here, can you elaborate on it please?

You’re right, my bad, I’m sorry, I’m still new at Godot and thought I could help. Glad you have a handle on it!

Same problem here on Godot 4.1.1:

Using load:

using preload:

Editor bug perhaps?

I wonder if it’s a bug they overlooked or something got “detached” with the intellisense. It’s still happening in 4.1.2 stable

If you set the type as a PackedScene, it will autocomplete when doing the dot operator. Example below.


1 Like

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

Privacy & Terms