UE Web Remote Control call python script

UE Web Remote Control call python script

UE remotely calls Python (UE Python API) script

Web Remote Control

Remotely operate Unreal Engine projects on a web client.
The Unreal Editor provides a powerful set of tools for manipulating nearly every aspect of your project's content. But in some cases, successfully using the engine in a large content editing process requires modifying the project from outside the editor UI.
The Web Remote Control system achieves this goal by running a web server in Unreal Engine and serving WebSocket messages and HTTP requests issued by remote web applications through a REST-like API.

Insert image description here

Enable plugin

Enabled Remote Control API

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-X1m3j7za-1690543928326)(./images/RemoteControlAPI.png)]

Start service

WebControl.StartServer
WebControl.StopServer
WebControl.EnableServerOnStartup

[The external link image transfer failed. The source site may have an anti-leeching mechanism. It is recommended to save the image and upload it directly (img-ZlY1Iegl-1690543928327)(./images/WebControlServer.png)]

WebPut call

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!")

Insert image description here

function with parameters

Insert image description here

Install Python

 1

Call

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


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

Postman test calls API

1

2

3

4

Related plug-ins

Insert image description here

reference

  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

Guess you like

Origin blog.csdn.net/mrbaolong/article/details/131986753