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

I want to preload the players scene in the players script to respawn the player but it says that it can't preload the scene

enter image description here

enter image description here

enter image description here

in Engine by (44 points)

have you double checked the path is correct?

yes, i dragged it in. it told me, that it is already preloaded what it indeed is, but i want to instance it after it got destroyed with the queue_free command/function to "Respawn" The player scene

if Player is name of a class then the variable should be called something else to avoid confision? _player or something. May not apply in this case.

3 Answers

–3 votes

Use

var respawnplayer = get_node(".")

by (75 points)
0 votes

I had a similar issue. I don't think we can preload the same scene that the script is attached to (I'm guessing to avoid getting stuck in a loop). Perhaps have a second scene that handles the respawn and preload that instead, which in turn loads the player.

by (14 points)
0 votes

In my case was the same error. The problem was in custom resource with several "PackedScene". This resource was connected to Player export slot.

Code example from my custom resource:

export(PackedScene) var inventory
export(PackedScene) var buy_menu

I solved it by changing "PackedScene" to "String, FILE" and the error disappeared. Maybe your case connected with this type of export.

by (16 points)
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.