Skip to content

Instantly share code, notes, and snippets.

@markserena
Created November 24, 2023 06:19
Show Gist options
  • Select an option

  • Save markserena/7a6869c725729e387f549b5b77d9dab9 to your computer and use it in GitHub Desktop.

Select an option

Save markserena/7a6869c725729e387f549b5b77d9dab9 to your computer and use it in GitHub Desktop.
unreal notification
from threading import Timer
import unreal
@unreal.uclass()
class DeletedUnusedMaterials(unreal.EditorUtilityTask):
pass
def update_notification(notification, message):
notification.set_task_notification_text(str(message))
notification.finish_executing_task()
def create_notification():
notification = DeletedUnusedMaterials()
util_subsystem = unreal.get_editor_subsystem(unreal.EditorUtilitySubsystem)
notification.receive_begin_execution()
notification.finish_executing_task()
util_subsystem.register_and_execute_task(notification)
return notification
def my_function():
# Create a notification dialog popup
notification = create_notification()
# Create a threaded timer to force notification to close
t = Timer(2.0, lambda: update_notification(notification, 'Successfully Completed.'))
t.start()
print("...code...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment