Weird thing is that if my UMaterialInstanceDynamic instance is instantiated in the same timer function, then call SetVectorParameterValue(…) succeeded, and I can see the material changed. However, after I add this variable as a class member, and init it in constructor but call it in timer function, it fails with the following exception.
Description:
-
exception message: Access violation reading location. 0xFFFFFFFFFFFFFFFF.
-
code line: Runtime\Core\Private\HAL\MallocTBB.cpp:106
-
Called by SetVectorParameterValue called of a UMaterialInstanceDynamic* ptr which is initialized in the Actor’s constructor, and the material.
-
Upper call stack: TimerManager managed timer, call this function.
I have no idea what is wrong, any help?