This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

The problem is quite simple: I make the classic scheme of adding a scene with instance and everything normal, except that the first time the new scene appears, the game freezes a lil. And it's only the first time the scene is instanced.

Imagine this: I make a instanced scene that is a shot and this shot will appear several times in the game, even if it disappears from the screen after a while (with "queue_free"), only first time it appears is that the freeze problem occurs.

How can I solve it?

Tks guys

in Engine by (174 points)

1 Answer

+1 vote
Best answer

Just had the same problem, and fixed it by using preload function:

var my_scene= preload("res://scenes/MyScene.tscn")

If you use "load" function just replace it with "preload". Load is lazy fetching, it fetches the resource when it appears. Preload is eager - it does it at the start.

by (713 points)
selected by

solved; you are my hero

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.