UE4编辑器Python编程4——创建任务进度条

# coding: utf-8

import unreal

import time

def executeSlowTask():
    quantity_steps_in_slow_task = 1000  # 步数
    with unreal.ScopedSlowTask(quantity_steps_in_slow_task, 'My Slow Task Text ...') as slow_task:
        slow_task.make_dialog(True)  # 可设置是否添加取消键
        for x in range(quantity_steps_in_slow_task):
            if slow_task.should_cancel():# 按取消会触发到这个函数
                break
            # 进入循环帧
            slow_task.enter_progress_frame(
                1, 'My Slow Task Text ...'+str(x)+'/'+str(quantity_steps_in_slow_task))# 这里可填入每帧的显示
            time.sleep(1)

UE4编辑器Python编程4——创建任务进度条_第1张图片

你可能感兴趣的:(UE4)