Web Remote Control
- Remote Control机制的运作需要开启RemoteControl插件
- Remote Control Web Application的运作需要在开启RemoteControl插件的基础上额外开启RemoteControlWebInterface插件
- 浏览器端的布局结果存储在RemoteControlPreset资产里。若不保存对Preset资产的修改,则在web server重启后,client端的布局修改会丢失。
管理Server
The Web Remote Control system relies on a web server launched and managed by the Unreal Editor process. For your security, this server only runs when you explicitly activate it. To control when the server runs, you use a few simple console commands:
Command | Description |
WebControl.StartServer | Starts the web server and begins listening for incoming requests on port 30010. |
WebControl.StopServer | Stops the web server, preventing any more requests to your Unreal Editor instance from being handled. |
WebControl.EnableServerOnStartup | Starts the web server automatically whenever this Project is opened in the Unreal Engine in any supported mode: in the main Unreal Editor window, in a Play In Editor (PIE) session, or in the -game mode of the Unreal Editor. |
关于端口的问题,涉及3个server的监听端口:
Remote Control Web ServerHttp Server Port: 30010Remote Control Web Interface
WebSocket Server Port: 30020Http Port: 7000
Web Remote Control依赖的nodejs版本
UE4.27
- Minimum version: 8.
- Maximum version: 14.15.5.
UE4.27.2 RemoteControl的坑
升级到4.27.2后,需要在swtichboard的nDisplaySettings的Extra Cmd Line Args字段添加-RCWebControlEnable -RCWebInterfaceEnable这两个参数。这样WebRemoteControl才能正常工作。
要在打包后的程序中使用RemoteControlWebInterface,还需要在目标机上运行程序的同时,执行WebApp。也可以把RemoteControlWebInterface插件下的WebApp目录拷贝到打包程序目录下。再写一个Run.bat脚本放在打包程序目录下,用来一次性启动这两个程序:
start My.exe -RCWebControlEnable -RCWebInterfaceEnable cd .\WebApp call .\Start.bat
No preset available
fetch(new Request('http://127.0.0.1:30010/remote/preset/NewRemoteControlPreset',{ method:'GET', headers: {'Content-Type': 'application/x-www-form-urlencoded'} }))
Web端提示【No preset available】的错误时,除了要如图所示使用VaRest插件发起特定URL连接外,还有一点必须注意:RemoteControlPreset资产必须放在Content目录下,不能放在子目录。
可以放在Plugin的Content下。
- Microsoft Edge浏览器的模拟请求插件:ReqBin HTTP API Client
- vsc的thunder client插件更好用,且自动记录每一条request