Text node is recreating after minimizing window (DEF-2520)

When i minimize window. Text nodes is recreating. I have a gui with text nodes. Then i changed text, font scale and etc.Then i minimaze window.But when i maximize window, my text node is reverted to default state(mb was recreated)
My os is windows 10.

1 Like

Are you using multiple gui layouts? And could it be that you’re getting a layout_changed message to your gui_script when the app is minimized/maximized? When the layout changes the gui will be reset but since you get the callback you’re able to recreate the gui into the correct state again.


yes i use multiple layouts.Actually i don’t need different layouts, but i don’t find a way to change default layout size(changing size in game.project not good idea, because i want gui in 2048x1536, which bigger then my screen, and in html build window will be too big).
I get messages:
DEBUG:SCRIPT: hash: [layout_changed]
DEBUG:SCRIPT: hash: [] --layout_id
DEBUG:SCRIPT: hash: [layout_changed]
DEBUG:SCRIPT: hash: [Landscape] --layout_id

So when i maximaze window layout set to default, then set to landscape. Why 2 times, is it realy need. Also why layout changed? When i stretch the window, i never get this messages.

1 Like

The default layout size corresponds to what you have in game.project and that is as far as I know the only way to change it.

Hmm, are you saying that you get two messages when you maximise the window?

You should get a message as soon as the layout is changed. The system will chose the layout that is closest to the current window size.

1 Like

Yes i get 2 messages when maximize window.My game size is 1366x768(16x9) My layout size 2048x1536(4x3). When i stretch window, i newer get layout-changed nessages

i created a sample project. When i use default display_profiles i also get 2 messages when maximaze window.
DEBUG:SCRIPT: change from:hash: [Landscape] to hash: []
DEBUG:SCRIPT: change from:hash: [] to hash: [Landscape]

Sample: https://yadi.sk/d/glhbmzAW3GSmFS

Ok, so I don’t have any access to a Windows machine from where I’m at right now, but I do get messages when I change the window aspect ratio from landscape to portrait and vice versa on OSX:

I do not get any messages when the app is maximized or minimized on OSX though.

And you’re saying that on windows when you press minimize or maxmize you get two messages?

@sven or @Mathias_Westerdahl , are you able to test this behaviour on Windows? Do you get two messages when you maxmize/minimize and do you get any message when you change aspect ratio?

1 Like

In any case, if you have multiple layouts you need to react to layout_changed messages and update your nodes with whatever dynamic data that you might need.

When i change window size i get message from portrait to landscape and vice versa.
When i minimaze window i don’t get any message but when i maximaze window i get two messages.

Ah, I see. I’m guessing that the first message is when you minimize and the second is when you maximize, but the minimize message gets “queued up” somehow when the app stops running.

So is it big, or expected behavior?

Not sure. @Mathias_Westerdahl or @Johan_Beck-Noren?

I’d say it’s unintentional, we have a related issue, so I reused that one (DEF-2520)

1 Like

Up theme.

We add single layout for gui_scene and on minimize/maximize (Windows) got next message:

{ --[[0000023D0D290AF0]]
  message_id = hash: [layout_changed],
  message = { --[[0000023D0D290930]]
    previous_id = hash: [Default-Wide],
    id = hash: []

{ --[[0000023D0D291B90]]
  message_id = hash: [layout_changed],
  message = { --[[0000023D0D291A50]]
    previous_id = hash: [],
    id = hash: [Default-Wide]

For single layout in gui scene it’s not expected to catch layout_changed. Chance to reset all GUI scene is not so good :slight_smile:

Is it safe to use single layout and to be sure gui scene will not be reset on mobile platforms (iOS/Android)?

PS: I am “the Necromancer” again, 3 years later :wink:


That sounds really strange. Can you please create a minima repro case for this?

Sure, here is the link: layouts_bug.zip (2.9 KB)

The bug is reproducing on windows (not macOS, don’t sure about mobiles).

To reproduce just minimize and maximize the game window. The text on the scene should be changed from “this text from gui script” to “this text default for layout

Gui scene contains single layout. It’s used to change gui scene size for this gui scene without changing game.project game dimensions.

Created https://github.com/defold/defold/issues/5016

How would you handle this with Druid on something like Dynamic Data Lists? Would you rebuild the whole list every time the window is minimized an reopened? I do have 2 layouts but having the application minimize count as a layout change is weird.
Either way if my user resizes the app I do need a way for the content to stay the same, and unfortunately because I am using a “prefab” component all the text in the Dynamic list gets reset to the text of the “prefab”