Download

difference between NativeConstruct method and class constructor

Hi

When i create class that inherit from UUserWidget, and add constructor, visual studio build project successfully, but editor crashing right after that.
I found some example where instead of constructor there was NativeConstruct method or Initialize.

Can someone tell me why i cant create constructor to intialize all variables? Only need to use those metods.

http://api.unrealengine.com/INT/API/…ize/index.html

doc say nothing baout this method

pls help

Constructors in UE4 are a bit strange just due to how class properties are serialized in. Initializing simple POD values is about the only “safe” thing you can do. Can you post the code that is causing the crash?

That’s because that class is a wrapper for a Slate class; Slate classes are native, they’re not UObjects so the UMG class need a way to call Slate’s Construct() method.

If you don’t make sure Construct() in Slate level is called then UMG class will crash.

thanks, this helps a little bit, and there is no need for post my code, just create new class, default ue4 created this class in without constructor so i add one , and after build editor crash, did not start write anything else