I’m seeing an odd bug with attempting to set a parameter on a collection.
I’ve created a new Material Parameter Collection called SelectionHighlightCollection. It holds 1 scalar parameter, LineWidth.
I’m trying to modulate that from my custom HUD object’ blueprint. Inside my HUD’s tick function, I call a custom BP event on my HUD, SetSelectionLineWidth, that then calls SetScalarParameterValue.
The editor still passes in ‘None’ as the ParameterName FName param when it calls UMaterialParameterCollectionInstance::SetScalarParameterValue(), fails to set the parameter at all, and gives me warnings that it was called with invalid ParameterName ‘None’ even though it’s clearly showing it set to LineWidth in the BP.
However, this bug disappears if I drag off of the name and create a literal FName called LineWidth.
The blueprint you see in the upper right gets triggered inside every frame of our HUD’s tick function (we turned ticking on for our HUD subclass). So every HUD tick, we end up calling that Event Set Selection Line Width, and as you can see from the screenshot of the blueprint itself, we’re passing in ‘LineWidth’ as the parameter, which it auto-selected for us … but somehow isn’t getting translated properly when the game runs.
Again, I can work around it easily enough by making this a literal FName param, but this seems like a clear bug so I wanted to give you guys a heads-up about it.
Looking at the code along the bottom, it seems as though the name is not getting passed in when SetScalarParameterValue is being called in the code. To help investigate what is causing this I’m wondering where this function is being called from inside the code.
Doug, the code is basically what’s shown below. Like I said, inside my Tick(), I’m calling a custom event SetSelectionLineWidth and passing in the line width as a float, which then calls Set Scalar Parameter Value as you can see in the blueprint screenshot above (from the HUD’s blueprint), and relying on the defaulting of the “Parameter Name” param on that function to default to ‘LineWidth’ like it says it’s doing.
void AOCHUD::Tick( float deltaSeconds )
Super::Tick( deltaSeconds );
float line_width = /* a bunch of code to calculate the width */;
SetSelectionLineWidth( line_width ); // Call my own BP event!