Unreal Engine Crash upon level change/reload

Thank you very much for making a Spout plugin for UE4 that is compatible with v4.20.

we are running into an issue where the plugin causes our project to crash when we reopen the level that has the Spout Blueprints. This only happens when we hit Play in Standalone game and not in the Play in Editor mode. Any support here would be greatly appreciated.

This problem is occurring while receiving a texture.
Relevant section from the crashlog is pasted below:
UE4Editor_SpoutPlugin!ResetTexture() [c:\users\karan\documents\unreal projects\pabt\plugins\spout\source\spoutplugin\private\spoutbpfunctionlibrary.cpp:99]
UE4Editor_SpoutPlugin!RegisterReceiver() [c:\users\karan\documents\unreal projects\pabt\plugins\spout\source\spoutplugin\private\spoutbpfunctionlibrary.cpp:208]
UE4Editor_SpoutPlugin!USpoutBPFunctionLibrary::SpoutReceiver() [c:\users\karan\documents\unreal projects\pabt\plugins\spout\source\spoutplugin\private\spoutbpfunctionlibrary.cpp:539]


Karan Parikh

Hi Karan,

I think I experienced something similar when I didn’t properly close spout senders/receivers in my blueprints. Obvious node name ambiguity aside, I think you have to use ‘Close sender’ even with Spout receivers everytime before you intend to open it again.

Are you using our plugin with Lightact at all, or is it with another program?



Hi Mitja,

Thanks for your reply! I am in fact, using the ‘Close Sender’ node during EventEndPlay.

I am only using the spout nodes in one level and I have spout nodes in an actor Blueprint and not the level blueprint. I am using the “OpenLevel” node to switch between different levels in my project

I just learned about LightAct and it seems great for a lot of the projects we do in UE4 such as realtime interactive projection mapping. We do plan on using LightAct for our projects and I’m eager to learn more about it especially for using shared memory.

For our current use-case, we are using spout to send over textures from vvvv to UE4.

Hi Karan,

I would suggest trying to make sure that the Close sender node is triggered just before the level change. Using EndPlay node was suggested under the assumption that you don’t use levels in UE4 (a bold assumption, I agree - we will probably amend the documentation to this end). You would probably also have to make sure that Spout Sender node is not triggered during the level change, but only after all required components such as Scene capture component etc have loaded.

Have you considered using just one level and placing different environments in different places and moving cameras back and forth?

Good luck!

Warmest regards,

Hi Mitja,

The Close Sender node was in fact, being triggered.
It turned out there was an issue with the way the material was being handled when the level gets reloaded.
We have made changes to the so that the parent material gets reinitialized properly when the level gets reopened or during transitions. It is working now. I am sharing the contents of the file here so anyone else who runs into this issue has a solution :smile:

Attached below is the edited version of the file, since Answerhub doesn’t allow cpp files to be attached I have made it a txt file:SpoutBPFunctionLibrary.txt (21.9 KB)

I’m glad that it works, Karan! And thanks for sharing the file. It reminds me to enable sharing of .cpp files in the future.



P.s. and let me know when you’ll start using Lightact instead of the competition :slight_smile:

You’re welcome! A collaborator of mine uses vvvv and that is why we need to use Spout. I don’t know vvvv well enough to know if it is a competing product with LightAct. Up until this point, we have only been using UE4 and outputting straight from UE4 so we are not using any competing products. We would love to see how we can use LightAct in symbiotically with UE4 :slight_smile: We do a bunch of sensor integration and 3D projection mapping work using UE4 and I think LightAct is going to be extremely useful to us.

This is just to confirm that we’ve included this fix in the regular Spout-UE4 repository on Github.

Thanks to @karanmonster for submitting the fix. :+1: