A few days ago, I made the following post concerning a problem with BP construction scripts:
I looked a bit further into this and it seems that this is indeed a bug.
The constructions script effects are only visible in the editor viewport and not in game.
- Create a material collection with a vector parameter
- Create a material(instance) that has this collection parameter
- Create a BP with a static mesh actor with that material
- Change the parameter value of the collection in the construction script
- Compile the BP
- You will see now that the mesh material color changes in the viewport as selected
- Hit Play
- You will now see the mesh in its unchanged default material settings
My current workaround is: Wrapping all initialization code in a function and call it from the construction script (to make the editor viewport update) and the Begin Play event (to have the changes shown in game).
But its not that utterly elegant…
It seems to get even weirder:
The BP instances now behave as if they were one. If I change a value of a varaible of a BP instance, all other instances behave as if they were changed as well.
I made a little sample project, available here: http://www.filedropper.com/toolslite
I commented all the BP code. Just try the following and see how the objects behave
- Observe behavior in editor and PIE, wether the (only) node in the event graph is connected to BeginPlay
- Choose different Tint values per instance and play around with the “Override” booleans per instance. Observe how colors change on all instances
- Change color groups per instance and see how colors change on all meshes again
Either there is something broken, or I havent understood the concept of material collections ands changing parameters at runtime.
If so, let me know what I did wrong…