Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
GUI Best practices majestic-turtleHi,
Is it okay to use a copious amount of MarginContainer when building GUIs in Godot? I just use these like CSS padding and margins with containers nodes set to expand. Coming from web design, it feels more natural, but the hierarchy becomes kind of bloated quickly. So I've done stuff like create a scene that I instantiate on my main GUI just for a panel that I need to repeat for example.
I'm asking because you are using a minimum height size on the Label node here, and my instinct would have been to just use a MarginContainer.21Dec. 16, 2024
Setter Method ConfusionCave Darr I feel like I may have unintentionally glossed over setter methods when they were first introduced.
I don't understand their syntax, or use case. When are they needed and when not. Which module and lesson where they first taught?
Thanks! 71Oct. 31, 2024
CanvasLayer in lower 25% of the screenOldManBradHi, having an interface issue. I have worked through this exercise a few times and for some reason, whenever I create a canvaslayer, instead of it starting in the upper left of the screen, it is appearing in the bottom right of the screen in the editor. When I set it to be full screen, it remains in that spot in the editor, but does cover the entire screen on launch.
Just having trouble resizing the pausescreen control and child containers.
What do you recommend?50Feb. 10, 2025
Shader not working on HTML exportDMKI am using Godot 4.3 on Compatibility mode, and the blur shader does not work when I export the game to html. It just shows a completely black image.
Any way to fix this?30Jan. 12, 2025
Setter function not called on default value assignment?DMKIn the course, you said:
> When creating the objects, the engine assigns the default value to each property. This is when the setter is first called.
But I've checked that this is not the case:
```gdscript
var test_variable = 1 : set = set_test_variable
func set_test_variable(val):
test_variable = val
print('Hello World')
```
This code does not print 'Hello World' when the scene is run. Did I misunderstand what you meant?10Jan. 08, 2025
Adding space between buttons!AJ StudiosI noticed that after we add border expansion to the buttons they overlap and the gap between them is not visible. [https://postimg.cc/Yh1v0ws1](https://postimg.cc/Yh1v0ws1)
So I ended up selecting the VBoxContainer and adding a theme override with a separation of 30 since there is 10px expansion on top and 10px expansion at the bottom. That way there is a 10px expansion in between but I don't think this is very practical. [https://postimg.cc/YhqcP5Wp](https://postimg.cc/YhqcP5Wp)
I couldn't figure out how to make the VBoxContainer adjust to the edges of the buttons. There was no option available since the "Layout Direction" is Inherited from the parent node, the Container Sizing is greyed out. [https://postimg.cc/SnRnm1w4](https://postimg.cc/SnRnm1w4)
I found another solution, I added an empty control node between the nodes and added a "Custom Minimum Size" to create a gap. This works but is also not intuitive. [https://postimg.cc/wR6zMhNY](https://postimg.cc/wR6zMhNY)
Is there a way to expand the VBoxContainer so that it always wraps around the buttons even after expanding the margins? That way there is a constant clean and precise separation.50Dec. 24, 2024
Question relating the `lerp()` functionAbdul Hannan AhmedHi!
If I'm not wrong, I think I figured out what the result of the lerp function will be.
```gdscript
var starting_value = 0.0
var ending_value = 10.0
var weight = 0.7
lerp(starting_value, ending_value, weight)
const FORMULA := starting_value + [ (ending_value - starting_value) * weight ]
```10Nov. 12, 2024
A bit confusediDieHello,
At some point, you explain that we need to check if some nodes are null to
> prevent a potential issue
but right after, you explain that the setters are called before the nodes are available:
> This process happens before nodes are added to the tree, so before other nodes are even available!
When I read that, it seems to me that it is not a potential problem but an actual one that will occur every time we instantiate that scene.
Is it the case?
By the way, is there are reason why you say
> so before other nodes are even available
and not "so before other nodes are even **ready**"?
Related to that, according to me, the property `Menu Opened Amount` is only applied in the preview thanks to the `@tool` annotation (I guess because the node is ready in the preview) but when you launch the game, it is never applied because the setter is applied "too early".
I assume this is not really a problem because in next lesson, we will animate the pause screen -> we'll call the method `set_menu_opened_amount` multiple times.
But wouldn't it be better to make sure the initial property is taken into account by doing this (or did I miss something)?
```gdscript
func _ready() -> void:
set_menu_opened_amount(menu_opened_amount)
```
Another thing that confused me is that the info block
> Nothing is happening when I move the slider!
was put after the sentence
> *Give it a try!*
(with a video in between).
If I understand correctly the change was not picked up because when you add `@tool` you need to reload the scene after.
Is that correct? And if so, it would be better to explain it before proposing to test.
Dai20Nov. 02, 2024
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.