Download

How do you get an attached component to save?

So I have a custom UActorComponent that I’m programatically attaching to actors. It doesn’t persist between saves though. How do you get it to save? This is what I’ve tried so far:



            UMyComponent * MyComponent = NewObject<UMyComponent>(Actor);
            MyComponent->RegisterComponent();
            MyComponent->SetFlags(RF_MarkAsNative);


So that’s just guesswork right there. Is it a particular flag I need, or something else?