How to programmatically start/stop Pixel Streaming in Editor

I’m trying to find a way to start and stop Pixel Streaming programmatically in my project in Editor, using either Python, C++, or console commands.

I’ve enabled the Pixel Streaming plugin in my project, but I’m struggling to control it from code. Here’s what I’ve tried so far:

  1. Tried to access unreal.PixelStreamingStreamerComponent using both Python and C++, but couldn’t find a way to do it.
  2. Enabled -AllowPixelStreamingCommands and attempted to use console commands ‘startStreaming’ and ‘stopStreaming’, but these don’t work.

I’m looking for a way to start and stop streaming without using the editor toolbar.

Could someone please provide the current, correct way to:

  1. Start Pixel Streaming programmatically
  2. Stop Pixel Streaming programmatically
  3. Switch Between Level Editor and Full Editor

If possible, I’d appreciate examples in Python, C++, or even correct console commands if that’s the best approach.

Hi there!

I’d be happy to shed a bit of light on this for you.

If you’d like to programmatically start and stop level/editor streaming, you can use the following C++ code:

For Pixel Streaming 1:

`IPixelStreamingEditorModule& Module = IPixelStreamingEditorModule::Get();

// Stream level editor
Module.StartStreaming(UE::EditorPixelStreaming::EStreamTypes::LevelEditorViewport);
// Stream editor
Module.StartStreaming(UE::EditorPixelStreaming::EStreamTypes::Editor);
// Stop streaming
Module.StopStreaming();`And for Pixel Streaming 2:

`IPixelStreaming2EditorModule& Module = IPixelStreaming2EditorModule::Get();

// Stream level editor
Module.StartStreaming(EPixelStreaming2EditorStreamTypes::LevelEditorViewport);
// Stream editor
Module.StartStreaming(EPixelStreaming2EditorStreamTypes::Editor);
// Stop streaming
Module.StopStreaming();`This should get you going in the right direction, but please let me know if you had any further questions!

Kind Regards,

Michael