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.
Create a simple blueprint with TWO StaticMeshComponents.
On each component add CubeMesh and simple MaterialInstance with single param (for me it was ColorParam for BaseColor).
Create custom event that will set MID’s and params.
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?
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.
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:
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?
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.
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 | Unreal Engine Documentation)
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.
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.