Having an issue with my variables resetting to the default value when I duplicate them (with any hotkey or any method) within the level editor. The construction script I built uses static meshes, scalar, and vector3 variables but it is only ones that relate to the dynamic material instances that reset when I duplicate. The static meshes stay and one of the dynamic material instances keep their variable values…I have no clue what is going on and from what I have found so far the only thing I can reason is: BUG. But it is probably me. Any thoughts? I’m still fairly new at blueprint.
Here is the the gist of one of the material instance generation, variable set, and material set. I create all the DMI then Set All the perimeters to public editable variables and then set the material to the target DMI. I think this is the first method you said?
Still having an issue… I reordered things in the construction script and some of the variables still reset to default value. Looking back on it, the only variables that stay are the static meshes (I have 8), the float variables that only change static mesh locations, and some of the vector perimeters that decide the color of masked part of 2 dynamic material instances. I completely unplugged the entire construction script and nothing changed. I really have no idea WHY. Even with nothing technically going on in the blueprint (Unplugged at construction beginning), all the variables have the same settings, and the order of the variables changing, only the same variables are being transferred and not reset to default value…bug?
The difference I see from your’s to mine is that it has a static mesh component as a target rather than the actor itself, there are several more variables in total (29) and no matter how the construction script is connected (or connected at all) the same variables reset when duplicated. I thought it was a issue with how many or what order the Dynamic Material Instances where being generated, but with or without them being generated it is all the same…
Maybe there is a way to work around this? I was messing around with using Add Child Actor Component but kept running in to an infinite generation error it it was within the blueprint I want to generate (understandably?) and if I generate it from a separate blueprint, I lose control of any variables. Any suggestions? I just want to have this blueprint with all the same variables repeated along a row. To be more specific, its a row of arcade cabinets that is all the same game.
After Rewriting the code using arrays and adding more variables, I think I have pinpointed the problem. There is a cap to how many variables will survive the duplication process. Now the code is in a place I like, the variable that resets has nothing to do with dynamic material instances. It is just one of the static mesh component variables that clears when I duplicate. This was not happening till I added my final variable. Is there a setting to increase the amount of variables are held in memory on duplication?
Did you try the SetVectorParameterValueOnMaterials function that needs an MID as input and a color instead of SetVectorParameterValueOnMaterials that needs a Static Mesh and a Vector?
Cant Reproduce (4.16) works as expected.
Result:
Are you doing anything else with the Variables? Construction script will Run again if you duplicate so if you cahnge things in the script it will happen again on duplication.
Make a simple script if Possible that definitly does not work that I can try out. (not gonna use 4.14 though ;P)