Skip to content

Error with container size overridden on subsystem_containers.gd #2650

@Gaalperen

Description

@Gaalperen

The problem: Yellow annoying message on Debugger

Using the VN style, whenever a portrait or background appears on screen, Godot engine's debugger sends error messages.

To Reproduce
Steps to reproduce the behavior:

  1. Go to an scene where Dialogic is initialized.
  2. Let timeline events occur.
  3. See error

Expected behavior
I expect yellow annoying message to not bother me~

Screenshots
My project running with my cute characters on screen.

Image

Meanwhile, errors shown on debugger
Image

System:

  • OS: Windows 10, 11, Fedora, (Linux Linux 6.15.7-200.fc42.x86_64)
  • Godot Version: 4.4.1
  • Dialogic Version: 2.0 Alpha 17 WIP

Solutions

Workaround

The debugger points specifically to 2 lines of code on the Dialogic script called: "subsystem_container.gd"
First, to line which says: "container.size = final_rect_resize"
This line is inside the function: "func resize_container()"

Second, to line which says: "container.size = info.size".
This second line is inside the function: "func load_position_container()"

What debugger says is always:

W 0:00:04:899 subsystem_containers.gd:247 @ load_position_container(): Nodes with non-equal opposite anchors will have their size overridden after _ready().
If you want to set size, change the anchors or consider using set_deferred().
<C++ Source> scene/gui/control.cpp:1443 @ _set_size()
subsystem_containers.gd:247 @ load_position_container()
subsystem_portraits.gd:37 @ load_game_state()
DialogicGameHandler.gd:359 @ ()
DialogicGameHandler.gd:365 @ load_full_state()

W 0:08:01:894 subsystem_containers.gd:188 @ resize_container(): Nodes with non-equal opposite anchors will have their size overridden after _ready().
If you want to set size, change the anchors or consider using set_deferred().
<C++ Source> scene/gui/control.cpp:1443 @ _set_size()
subsystem_containers.gd:188 @ resize_container()
subsystem_containers.gd:83 @ move_container()
subsystem_portraits.gd:261 @ _move_character()
subsystem_portraits.gd:436 @ add_character()
subsystem_portraits.gd:382 @ join_character()
event_character.gd:122 @ _execute()

Note that my line number may differ since i'd added comments to the original code to understand it.

However, what Godot seems to be saying is that it needs the code to use "set_deferred()". At this extend, what I understand is that currently the size is being overridden and that means calculated two times. First by our func _ready(). Then by Godot's system.

Possible fixes

So I took the easy way and just replaced the two lines of code using "call_deferred()" like this:

First, the line inside "func resize_container()"
-> from "container.size = final_rect_resize"
-> to "container.call_deferred("set", "size", final_rect_resize)"
Also note before this line you got: "container.position = container.position + relative_position_change" which could be more simple like: "container.position += relative_position_change"

Second, the line inside "func load_position_container()"
-> from "container.size = info.size"
-> to "container.call_deferred("set", "size", info.size)"

This way your games won't have the annoying yellow error message on the debugger :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions