UActorComponent: When to Register vs. Activate, and how?
I haven't been able to find any details online whether to use RegisterComponent or Activate, nor what the difference is; so, the first part the of the question is when to use RegisterComponent() or Activate()?
I would normally test this out and see what happens when either is called, but the kicker is I can't get either to work. In my header, I have the whole
What do I do?
asked Feb 05 '16 at 01:54 AM in C++ Programming
But you created first component itself, before call any functions for it? That's description for RegisterComponent method:
And that's description for Activate method:
So Activate just starts(or restarts) component's tick timer and enables Tick function if it was disabled. RegisterComponent register it inside it's owner and inside owner's world.
But before call above methods you must create component itself. If you want to create it within constructor then you can call CreateDefaultSubobject(...) method. If you want to create it dynamically then you can call NewObject method (but I didn't test it this way, so check these 2 links if you want: first, second)
Follow this question
Once you sign in you will be able to subscribe for any updates here