Skip to content

Instantly share code, notes, and snippets.

@RichardMarks
Created September 5, 2023 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardMarks/7c02da5a07997f1bf9ee9c0c9a6ef941 to your computer and use it in GitHub Desktop.
Save RichardMarks/7c02da5a07997f1bf9ee9c0c9a6ef941 to your computer and use it in GitHub Desktop.
Godot 4.1.1 Testing opening Window and FileDialog on macOS
  • When exporting an .app for macOS in Debug mode, everything works as-expected.

  • When exporting an .app for macOS in Release mode, the buttons do nothing at all.

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
extends Control
@onready var btn_1: Button = $CenterContainer/VBoxContainer/Button
@onready var btn_2: Button = $CenterContainer/VBoxContainer/Button2
@onready var window_dlg: Window = $Window
@onready var file_dlg: FileDialog = $FileDialog
func _ready() -> void:
assert(window_dlg.close_requested.connect(Callable(window_dlg, "hide")) == OK)
assert(btn_1.connect("pressed", Callable(window_dlg, "popup_centered")) == OK)
assert(btn_2.connect("pressed", Callable(file_dlg, "popup_centered")) == OK)
[gd_scene load_steps=2 format=3 uid="uid://b6e2fb382for3"]
[ext_resource type="Script" path="res://main.gd" id="1_xgemj"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_xgemj")
[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
layout_mode = 2
theme_override_constants/separation = 24
[node name="Button" type="Button" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
text = "Open test Window"
[node name="Button2" type="Button" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
text = "Open test FileDialog"
[node name="Window" type="Window" parent="."]
title = "Test"
initial_position = 2
size = Vector2i(320, 200)
visible = false
popup_window = true
[node name="CenterContainer" type="CenterContainer" parent="Window"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="Window/CenterContainer"]
layout_mode = 2
text = "Hello World!"
[node name="FileDialog" type="FileDialog" parent="."]
title = "Open a File"
initial_position = 2
size = Vector2i(640, 480)
ok_button_text = "Open"
file_mode = 0
access = 2
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Test"
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.1", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1024
window/size/viewport_height=768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment