Blueprint with MID's doesn't save properly.

Hi,

I’m experiencing a crash if my blueprint contains two static mesh components with two different Material Instance Dynamic.

It seems that if you create MID’s on your meshes and than save the map, after loading it becomes corrupted. It looks good on the first look but when you try to
delete it and than ctrl+z the engine crashes.

This is step by step guide how to reproduce this error.

  1. Create a simple blueprint with TWO StaticMeshComponents.
  2. On each component add CubeMesh and simple MaterialInstance with single param (for me it was ColorParam for BaseColor).
  3. Create custom event that will set MID’s and params.

  1. In property panel (Blutilities section) choose your event and click Run.
  2. You should get MID’s on both of your StaticMeshComponents.
  3. Save the map.
  4. Close the editor and load your map.
  5. Delete your blueprint and click ctrl+z.

Error I got:

Unhandled exception at 0x000007FEEC2E0EAB (UE4Editor-CoreUObject-Win64-Debug.dll) in UE4Editor-Win64-Debug.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

PropertyObject.cpp line 38:

if (ULinkerPlaceholderExportObject* PlaceholderVal = Cast<ULinkerPlaceholderExportObject>(ObjectValue));

Property that crashes: “OverrideMaterials”


Is there any workaround that we could use here? And most importantly, why this error occurs?

Hi .Wiech,

Does this occur in a clean, blank project with no additional content or is it limited to one project? Additionally, can you post your crash logs here so I can take a look? They are located at \Unreal Projects\PROJECTNAME\saved\log. Which preview version are you currently using?

Hi ,

This occurs in a clean ThirdPerson blueprint project, with starter content. The only thing that is new in the project are simple materials.

log:
link text

It seems that log is “cut” and probably there should be more info in it but that what’s I got after the crash.

I’m using github version from yesterday morning. I believe it’s already Preview 4 but the problem occurred also in 4.8.3, both git and launcher versions.

Do you have a sample project you can share that is experiencing this crash? I have not been able to reproduce this as of yet on my end.

I’ve created new blank project and problem still exists so here is the link:

Sample project

Hi Wiech,

I see that you are using a blutility in this. Is this a custom blutility? Do you have any information you can provide on what it’s purpose is?

Hi ,

I’m using this only to create MIDs in editor. You can see custom event in InstancesTest blueprint. Full graph is also visible on the screen I provided in the first post.
I don’t know any other way to simply run something inside editor from blueprints so that’s the reason I’m using blutility.

If You got my project, just put InstancesTest on the map and do the following:

  1. Delete it.
  2. Ctrl + z.
  3. Save map.
  4. Reset Editor.
  5. Open map again.
  6. Delete it.
  7. Ctrl + z. (crash should happen at this step)

Hi .Wiech,

The reason I asked is because I can reproduce this in your map, however I haven’t been able to reproduce it in a situation without blutilities involved. If you have the MIDs set on event begin play in a new map without using blutilities, the delete/undo does not crash the editor. Blutilities are still considered highly experimental and unstable/untested. Try calling the MID switch from the construction script or event begin play without the blutility, do you see the crash occur?

Hi ,

The solution with BeginPlay event is not acceptable because it doesn’t work in editor. So it’s like changing the base of the problem. Construction script works fine but that is not the effect I’m trying to achieve.

But…

I’ve created a plugin with button, from Plugin Browser and write code to get all the InstancesTest actors from the map to make instances for their static meshes and problem still remains. You don’t event need to restart the editor.

Here are links:

Plugin
Full project

Hey -

Could you explain what effect you’re trying to achieve? If you are trying to use MIDs to control changing the material on an object then setting up the MID in the construction script and using it later in the event graph is the recommended method. You can check the documentation for more information on setting up and using MIDs (Instanced Materials in Unreal Engine | Unreal Engine 5.1 Documentation)

Cheers

Hi ,

I’m trying to create a MID manager for editor. The main gol is to create something that won’t bother user to create MID’s in his blueprints if he would like to change some material instance parameters.

Here’s an example.

We got some really pretty mesh with a lot of materials on it. Materials are perfectly prepared, almost every variable is a parameter so You can change almost anything You want. Now, if I would decide that I want to make some variations of this mesh in my scene (or any other map) I would need to make material instances for each variation or create blueprint with custom variables to set MID’s parameters.

First approach is time consuming and number of assets increase.
Second approach is even more time consuming and in a bad scenario You ends up with couple of blueprints with many variables to handle the parameters. And for each blueprint you will have to assign MID’s in construction script.

I could of course use the second approach but since my approach works with custom Actor’s with multiple meshes and crashes when used on blueprints I believe it’s a bug.
Blueprint shouldn’t differ from normal Actor if it comes to such basic behaviors. In addition, it works with a single component but crashes with more so this is another reason to treat this as a bug.

Hello -

Thank you for your help tracking this issue down, I have entered a bug report in as UE-20601. As we investigate a solution I will keep you informed of any new progress here.

Hello Eric,

Great news. I’m waiting for more info about this issue :slight_smile: