Regarding issues with scene ready, GameObject loading, and scene loading

I encountered the following issues during the development process:

  1. I noticed that after a scene transition, the action loading of GameObjects lags behind the scene’s ready node. Specifically, if I send a signal to a GameObject in the ready section of a script to trigger its corresponding action, I found this approach to be unfeasible during testing. So I shifted my approach: I had the GameObject send a signal to notify the scene to complete initialization, and then the script would return after execution. Initially, I used the same action and linked it to AnyStat (to fulfill this function) before returning to the initial action. However, this triggered an infinite loop: signal emission → execution → signal reception → signal emission. Later, I resolved the issue by creating an entirely new set of configurations—including separate actions and connections. While this works, it makes my VS (Visual Script) action system cumbersome and bloated, and I haven’t found a way to optimize it yet.

  2. There’s another issue related to scene loading. As mentioned earlier, GameObjects lag behind the script’s ready state during scene transitions; but during loading, the order is reversed. When using the “Execute Load” action, GameObjects load first, which causes two problems:

    • First, if any script in the scene uses methods like get_tree(), it will throw an error stating that the scene is not fully loaded when you receive the GameManager.on_load signal.
    • Second, after I tried to stagger the loading process to prevent the game from crashing, I discovered that scripts using methods like config.load(SAVE_FILE) failed to read saved data correctly. The current dialogue information and progress I saved could not be loaded properly either.
      My solution was to avoid loading the scene entirely and instead only load the GameObject states, project variables, and switches. For loading the game from the title screen, I set up an additional project variable, exited the scene, and had the action connections check this variable—this ensured that save data loading only happened after both the GameObjects and the ready state were fully initialized. Thanks to the fact that my game only has 2 scenes right now, this method is workable, but it doesn’t feel like a proper solution.

These are the current issues I’m facing with scene loading and related processes, along with my temporary fixes. If you have any better ideas, please feel free to share them with me, or we can discuss this further.

1 Like