Search code examples
c++unreal-engine4

How can I reset to default blueprint my variables?


I want to reset my variables in code C++ as default blueprint like UE4 Editor does when you press the yellow arrow in editor

enter image description here

Does anyone know how can I make it? Thanks in advance!


Solution

  • For any UObject you can retrieve the default object. For example,

    APawn const* DefaultPawn = APawn::StaticClass()->GetDefaultObject<APawn>();
    

    This object will have the default values for that C++ class. If you have your blueprint class and you want to find the first native (C++) class in its hierarchy you might want to take a look at

    UClass::IsNative