Crash with Create Dynamic Material Instances

If you have the Virtual Camera Plugin enabled, it gives you access to a new “Create Dynamic Material” button that appears in the Details panel underneath Materials slots that have a material instance assigned

It will then make all the overridden properties accessible and editable in the details panel

[Image Removed]

[Image Removed]

This workflow is actually Ideal for Virtual Production stages that are in a multi-user session,

  1. we can edit materials and they live update right inside the details panel, we don’t have to create a custom blueprint, and we don’t have to go diving into materials/instance assets - which is the normal workflow for virtual production. Open up materials and constantly resave then to transact your changes.
  2. We lighten up the load on the multi user server, because we are not constantly resaving materials.
  3. This is compatible with level snapshots, if we move to this workflow, level snapshots will be time machines, Level snapshots do not save or revert asset changes like materials

However, we can’t adopt this as Standard Procedure… why?

Clicking on actors with dynamic materials causes a fatal error often.

Steps to Reproduce
Enable the virtual camera plugin, create a material instance with a lot of parameters that are overwritten.

Assign that material to a static mesh actor, and click the “Create Dynamic Material” Button.

Now this bug may take a few attempts to try, basically you need to click away and click the actor again, The callstack seems to be slate related, so likely related to drawing the UI.

Here is a video that demonstrates the crash in 5.5, as you can see, it doesn’t happen immediately, it can take several tries

Attached is a zip file with the project to repo the crash, and the crash log is in the saved folder.

Hi Matthew,

Sorry about the delay, and thank you for the video and repro project. I’m looking into this now and should get back to you soon.

Best regards,

Vitor

Hi Matthew,

Thank you for reporting this issue. I was able to reproduce the crash here and I just filed an internal bug report so that the engine devs can take a closer look. Here’s the bug tracker link: UE-316112. It should become accessible once the devs make it public.

In my tests, I noticed that the crash appears to only happen when a material parameter of type “Vector” is visible on the Details Panel for the inline dynamic material instance. Having a single “Vector” parameter there was enough to trigger the crash, and other parameter types didn’t seem to trigger it. Also, keeping the “Groups” category collapsed in the Details Panel seemed to prevent the crash from happening, but I did get a crash when expanding it. The easiest way I could find to repro the crash was to simply have two actors on the level, both with an inline dynamic material instance containing a vector parameter. After clicking on one of them on the Outliner, I used the up and down arrow keys on the keyboard to switch selection back and forth between them repeatedly until the crash was triggered.

Please let me know if you need any further assistance.

Best regards,

Vitor

This is still crashing. Please advise.

@VBarataBLab The tracker link you provided is dead - leads nowhere.

I am using Unreal Engine 5.3, source build. Please keep this in mind.

Okay, I’ve done some digging. The problem is in the SMaterialDynamicParametersPanelWidget.cpp file, which lives here:

\Engine\Plugins\Experimental\VirtualProductionUtilities\Source\VPMaterialsEditor\Private

Specifically, inside the AddParameters function.

The function is really weakly designed at the moment, and leaves dangling pointers which crash the Slate classes when they try to access child widgets of outdated layouts.

I’ve done a bunch of fixes on this file, and have reached a point now that I’ve been clicking around in the editor for 15ish minutes without any of these annoying access violation errors.

I’ve pushed the changes to my own fork here: (I’m building the engine from source on my project)

https://github.com/xtatik222k/UnrealEngine/tree/ue5.3.2-GG

For anybody working with the source engine who has the ability to re-compile the engine yourselves, you can get my version of the file here:

https://github.com/xtatik222k/UnrealEngine/blob/ue5.3.2-GG/Engine/Plugins/Experimental/VirtualProductionUtilities/Source/VPMaterialsEditor/Private/SMaterialDynamicParametersPanelWidget.cpp