schola.core.unreal_connections.StandaloneUnrealConnection
类定义
class schola.core.unreal_connections.StandaloneUnrealConnection( url, executable_path, headless_mode, port=None, map=None, display_logs=True, set_fps=None, disable_script=False)Bases: UnrealConnection
一个独立的连接,启动时会启动一个 Unreal Engine 实例。
参数
url
类型: str
连接到的 URL。
executable_path
类型: str
Unreal Engine 可执行文件的路径。
headless_mode
类型: bool
是否以无头模式运行。
port
类型: int, 可选
连接的端口,如果为 None,则会找到一个开放端口。
map
类型: str, 可选
要加载的地图。默认为 Unreal Engine 项目中的默认地图。
display_logs
类型: bool
默认值: True
是否显示日志。
set_fps
类型: int, 可选
运行过程中使用固定的帧率,如果为 None,则不使用固定时间步。
disable_script
类型: bool
Default: False
是否禁用 Unreal Engine Schola 插件中的自动启动脚本设置。
属性
executable_path
类型: str
Unreal Engine 可执行文件的路径。
headless_mode
类型: bool
是否以无头模式运行。
display_logs
类型: bool
是否显示日志。
set_fps
Type: int
运行过程中使用固定的帧率,如果为 None,则不使用固定时间步。
env_process
类型: subprocess.Popen, 可选
运行 Unreal Engine 的进程。如果进程未运行,则为 None。
disable_script
类型: bool
是否禁用 Unreal Engine Schola 插件中的自动启动脚本设置。
map
类型: str
要加载的地图。默认为 Unreal Engine 项目中的默认地图。
tcp_socket
类型: socket.socket, 可选
绑定到开放端口的套接字对象。如果提供了端口且我们不需要打开新端口,则为 None。
属性
address
返回连接的地址。
is_active
类型: bool (属性)
返回连接是否处于活动状态。
返回: 连接是否处于活动状态
返回类型: bool
方法
__init__
__init__( url, executable_path, headless_mode, port=None, map=None, display_logs=True, set_fps=None, disable_script=False)参数
- url (
str) - executable_path (
str) - headless_mode (
bool) - port (
int | None) - map (
str | None) - display_logs (
bool) - set_fps (
int | None) - disable_script (
bool)
close
close()关闭与 Unreal Engine 的连接。如果 Unreal Engine 进程正在运行,则会将其终止。
返回类型: None
connect_stubs
connect_stubs(*stubs)将 gRPC 存根连接到 Unreal Engine 通道。
get_open_port
get_open_port(url)在给定的 URL 上获取一个开放端口。
make_args
make_args()为 Unreal Engine 可执行文件提供参数。
返回: 要为 Unreal Engine 可执行文件提供的参数
返回类型: List[str]
start
start()启动 Unreal Engine 进程。
引发: Exception – 如果子进程已在运行
返回类型: None