UE Web Remote Control call python script

UE Web Remote Control call python script

UE 远程调用Python(UE Python API)脚本

Web Remote Control

在网页客户端远程操作虚幻引擎项目。
虚幻编辑器提供了一套强大的工具,几乎可以操纵项目内容的方方面面。但在某些情况下,要在大型内容编辑流程中成功使用引擎,需从编辑器UI以外对项目进行修改。
网页远程控制(Web Remote Control)系统实现了这一目标,它在虚幻引擎中运行一个网页服务器,服务由远程网页应用程序通过类似REST API发出的WebSocket消息和HTTP请求。

在这里插入图片描述

启用插件

启用(Enabled)远程控制API(Remote Control API)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-X1m3j7za-1690543928326)(./images/RemoteControlAPI.png)]

开启服务

WebControl.StartServer
WebControl.StopServer
WebControl.EnableServerOnStartup

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZlY1Iegl-1690543928327)(./images/WebControlServer.png)]

Web Put 调用

Python

RootPath/:Project/Content/Python/remote.py

import unreal

@unreal.uclass()
class RemoteClass(unreal.BlueprintFunctionLibrary):

    @unreal.ufunction(static=True)
    def remote():
        print("Hello from remote!")

在这里插入图片描述

带参数的函数

在这里插入图片描述

Install Python

 1

Call

http://localhost:30010/remote/object/call


{
    
    
    "objectPath":"/Engine/PythonTypes.Default__RemoteClass",
    "functionName":"remote"
}

Postman 测试调用API

1

2

3

4

相关插件

在这里插入图片描述

参考

  1. https://docs.unrealengine.com/5.0/zh-CN/remote-control-quick-start-for-unreal-engine/

  2. https://forums.unrealengine.com/t/executing-python-with-web-remote-control/156550

  3. https://docs.unrealengine.com/5.0/zh-CN/remote-control-api-http-reference-for-unreal-engine/

  4. https://blog.csdn.net/mrbaolong/article/details/131986753?spm=1001.2014.3001.5501

猜你喜欢

转载自blog.csdn.net/mrbaolong/article/details/131986753