0 votes

version=latest,Can a window appear at a set position, play a sound, and not focus here, and set "close the window after a few seconds", such as "notification window", how to do it?

in Engine by (18 points)

1 Answer

0 votes
func notification_show(notif: WindowDialog, sec: float, desired_position: Vector2):
    notif.rect_position = desired_position #moves the window to a location on screen
    notif.visible = true #makes the window visible
    notif.get_node("AudioStreamPlayer").play()
    yield(get_tree().create_timer(sec), "timeout") #waits for set amount of seconds
    notif.visible = false #or if instancing when needed, you can queue_free()
by (122 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.