I want to throw BP error in compile-time when specific property is null.
Is there any way to do through c++? (like overriding OnRegister, PostLoad, InitializeComponent…)
This would help to enforce particular rules and avoid user errors. I’d like to know this too.
You need to create a custom K2Node.
Call UK2Node::Message_Error and UK2Node::Message_Warn to output blueprint compile errors.
You can also create custom Pins on your K2Node to validate specific input types.
Also have a look at FNodeHandlingFunctor.
Related question about creating a K2Node: Custom Blueprint K2Node Creation: Node doesn't show up - Blueprint - Unreal Engine Forums