SetScalarParameterValue Access Violation

I have been struggling with the same odd error starting to pop up on me. Two things.

  1. I use:
    WaterMaterial = UMaterialInstanceDynamic::Create(SurfaceMaterial, NULL);
    I read that the use of this vs NULL can cause unexpected results - not sure this is an issue, but I read it so worth a try.

  2. I added a second “Create” statement just above my SetScalarParam statement and the crash went away. Which leads me to a sequencing of functions. I think your code is calling the SetScalarParam too soon, my test of adding a new create above it is not the fix, but it does say that in my case. If the object exists then the line doesn’t crash.

Then you need to track down your sequence issue.