Scene Keeps "Forgetting" Its Assigned Script?

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

Hi everyone!

I don’t really have enough technical insight to properly raise this as an issue on Godot’s GitHub, but I’ve recently started experiencing a very frustrating issue and I was wondering if anyone else has experienced it.

For some reason, Godot has started forgetting that one of my key scenes (Player Actor) has a script on it, no matter how many times I save this scene, as soon as I reload the project the script is no longer attached and I need to set everything up again just for that session before it’s all forgotten again on next load.

I have made absolutely sure the project and its contents are not read-only.

This problem briefly went away when I saved the scene again under a new name, but it has just reoccurred, and I suspect this will only become more aggravating should the project get any bigger.

I appreciate this could be my hardware’s fault, but as it’s this particular scene that keeps malfunctioning under numerous different names, I wonder if the issue is coming from elsewhere.

Has anyone else experienced this?

Does this scene inherit from parent scene ? This kind of bug makes me think of some conflict between parent and inheritor.

Inces | 2023-01-18 14:04

It’s based on a subclass, Actor_Player from the parent class Actor_Base but this script is applied to the scene’s root node

More here!

CFR_Godot | 2023-01-18 15:51

Is it possible that some external process is interfering here (virus scanner, backup program, file sync process, …)?

jgodfrey | 2023-01-18 16:01

Always a possibility, but I’ve been working on this project for a lil’ bit and it’s only just started happening today!

CFR_Godot | 2023-01-18 19:18

Key Scene "Forgets" Its Script on Project Reload · Issue #71610 · godotengine/godot · GitHub

Seems this might have been a bug relating to cyclic dependency - since removing a line in a multiplayer script that preloads the Player scene it seems to have stopped, hopefully that’s causation and not correlation lol

CFR_Godot | 2023-01-18 19:24

It would be quite helpful if you have put an image or a video of the issue.

CheetoPuffs | 2023-01-31 05:30

I agree with ur comment

nojinshop | 2023-05-22 09:39

:bust_in_silhouette: Reply From: flossythesheep

I came across this issue learning Godot (4.0.3 stable)

It was definitely a cyclic dependency issue as in the offending scene was trying to preload itself (I wanted to spawn instances of the same scene when hit). When I removed that and changed it to self.duplicate() instead the problem went away.

However I never got any error flagged by Godot (I also tried adding ‘–verbose’ to the shortcut) and it was another learning speed bump which could be avoided if it pointed out quite clearly somewhere that I had a cyclic dependency, or perhaps in this case “Error: Scene cannot preload itself”

Thanks for the explanation! I’ve been encountering the same issue and it was driving me bonkers, my player’s script sometimes detatched itself on startup for no apparent reason. Well, turns out I had a line in the script for the player to preload itself, after deleting that line the issue seems to be resolved.

ChunkyBites | 2023-05-26 14:04