Adding an Actor Component in C++ keeps crashing UE4
I have a custom Volume named CycloneDomain. I want to add a Procedural Mesh Component to this actor as soon as it is placed in the editor, but UE4 crashes every time the first line in the OnConstrustion function runs. I already added in procedural mesh dependencies in the .build.cs and .uproject files, and it compiles just fine as well.
.h file (just the parts you need to see ;)
.cpp file (I only put up the relevant code)
How do I change/fix this so it won't crash the engine
You should declare components like that in constructor so engine will be aware of by default. If you don't do that those component won't be visible in blueprint component list.
Other that that if you get crash first thing you need to do is check logs in Saved/Logs directory of your project. Every crash, or else it uncontrolled one (like calling on null or invalid pointer where OS suddenly stops the UE4) prints out information about in logs, is most cases those are assertions fails which engine meet unexpected condition and to prevent instability it crash it self and it prints failed condition, which require some figureing out what happened:
But is some cases there are full descriptive error that can cause crash and they are printed in logs, specially once related to component initiation, so checking the logs alone can solve many issues
Follow this question
Once you sign in you will be able to subscribe for any updates here