What are script functions _on_play_pressed and change_scene, shown by the debugger? Post the Control code.

    spaceyjase

    They don't have much to do with the issue, since the lag spike appears only when the problem scene enters the tree for the first time. _on_play_pressed uses the same scene transition function i use for other buttons that have to lead to specific scenes and the rest work fine.

    I tried building another scene from scratch with the same nodes and elements as the one causing the massive processing time and nothing in the new one seems to be out of the ordinary? I'll continue replicating it tomorrow but I have no idea why the original makes the game shit itself when loading

      Update:
      Turns out the file size for this scene is over 200MB. Why and how though?
      The six button textures I'm using are 190KB to 270KB, and the background is slightly larger at 1.3 MB

        antioxidant seems like godot thinks they're a problem but I can see why execution would run through those while the code doesn't do much. All good though, what's in the scene?

        More specifically: what's in the tscn? Has godot serialised something to it that it shouldn't have, perhaps via 'Local to scene' or some other toggle? Open it in a text editor and take a look!

          SnapCracklins
          This is all of it. During actual gameplay I'd have each button lead to a different menu but here I was just setting up modulation changes (I didn't want to add a slightly darker sprite for each button when clicked because it's a bit wasteful imo).
          Is there a way to go through a tscn file outside of the editor to see what's taking up so much memory? There are no excess nodes/textures/shaders that could lead to this much bloat.

          spaceyjase
          Yeah oh my god um....... The original file has nearly 14 THOUSAND lines of text when viewed in notepad and correct if I'm wrong but it seems to have printed every single editor change message and all images as PackedByteArrays?

          And in comparison the clone scene I created using the same nodes and assets (didn't directly copy and paste anything) has none of this and only contains 81 lines in txt... Seriously what the hell

            Can you use the clone scene and delete the one with the huge .tscn file?

            SnapCracklins an earlier stable version of the engine

            Or use a later 4.x version. I don't think you stated your version.

              DaveTheCoder
              Yep, that's what I'm currently doing to bypass this. thankfully it wasn't a hugely detailed scene and I can remake it in a couple minutes either way, so nothing has really been lost. Still wild that something like this can happen out of nowhere without altering any settings in either godot or github (desktop).
              Also, I'm using 4.1.1.stable

                Update 2:

                Ran into the same bloating issue when reconstructing the new scene, but I also managed to find the specific action which causes the file size to multiply by hundreds.
                In the scene each button has three label objects using the same root LabelSettings, however to adjust the font sizes etc. I used Make Unique on two of them. I apparently picked the recursive option on one, which caused the massive jump in memory usage.

                Before using Make Unique (Recursive):

                And after:

                Using recursive generates a PackedByteArray containing over 500 thousand characters, as well as hundreds of rows of cache data

                6 months later

                Thanks! This was super helpful. I noticed the problem when having Font Variations. Once I removed those, my game's performance increased dramatically.