Package to connect to a Unreal Engine instance and execute python commands
npm install unreal-remote-executionIn this API Unreal Engine instances are referred to as _"nodes"_.
typescript
import { RemoteExecution } from 'unreal-remote-execution';const remoteExecution = new RemoteExecution();
// Start the remote execution server
remoteExecution.start();
// This will start searching for nodes and return the first node found, it'll send a new ping every 1 second, with a timeout of 5 seconds
remoteExecution.getFirstRemoteNode(1000, 5000).then(
async (node) => {
// Once a node is found, open a command connection
// this will allow us to run commands on that node
await remoteExecution.openCommandConnection(node);
// Execute a command
const result = await remoteExecution.runCommand('print("Hello World")');
console.log(result);
// Close down the servers & connections once we are done
remoteExecution.stop();
},
() => {
console.log("No remote nodes found!");
}
);
`
$3
`typescript
import { RemoteExecution } from 'unreal-remote-execution';const remoteExecution = new RemoteExecution();
remoteExecution.start();
// Add a listener that is called when a node is found
remoteExecution.events.addEventListener('nodeFound', async (node) => {
// Check if e.g. the project name matches
if (node.data.project_name === "My Project") {
await remoteExecution.openCommandConnection(node);
// code continues here...
}
});
// Start searching for remote nodes
remoteExecution.startSearchingForNodes();
``
_*This is a third-party module and is not associated with Epic Games or Unreal Engine in any way._