So when I play project in editor all works fine. But If I’m trying to launch project as a game, or just play standalone game through editor then application is crashed and report points to this line:
BlockMesh->SetPhysMaterialOverride(PhysMaterial);
After that If I restart editor it’ll be not running with the same crash report. I sent report, my machine ID is 7B9A5253489C7324713D93A95783DC83
And 1 additional question. After first crash my level BP is broken too. It couldn’t to find BlueprintCallable function from my GameInstance class, I implemented there 4 BlueprintCallable functions(they successfully worked all past time and I didn’t change them), but level BP begins to see only first one. I don’t know why. Can anyone explain that?
Where in code are you creating your struct? Additionally, ConstructorHelpers are only meant to be used inside of a constructor. Can you post the full setup for the class (.h and .cpp) where this code is so that I can follow your setup on my end? Also, can you post the callstack and logs from the crash?
Thank you for reply. Yes I do it in constructor. Log and sources are attached. I didn’t remove unnecessary code, maybe that affects something. Physical material is just physical material created within editor
Since you’re setting this in the constructor, the crash is likely caused by attempting to access something before the game has had the chance to create it. I found that placing what is line 12 in your original post inside an if(GetWorld()) call will prevent the crash. This tells the game to set the physical material only if the game world has already been created.
Sorry for digging this up, but I’m having the same problem.
I tried to use your workaround, but I found that GetWorld() is always NULL in the constructor… So, although it does not crash, it does load the material either… ever. Not even when reloading the map.