Hi! So after stumbling upon this post:
After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...
Reading time: 1 mins 🕑
Likes: 20 ❤
I went ahead and tried adding my own custom character movement component to my custom character class. I was successful for the most part but have a few questions.
In the wiki article he has, within the custom movement component’s header file, defined:
virutal void InitializeComponent() overrrive;
with the .cpp implementation like so:
//UE_LOG //comp Init!
My question is where I’m I suppose to call the InitializeComponent() function? Or in what situations do I even need to call it? When I place this function within my custom movement component’s constructor UE4 crashes so I don’t think that is the place. Any insight on this issue would be greatly appreciated.
That should be called for you under the hood.
Test it out with:
UE_LOG(LogTemp, Warning, TEXT("Custom Component Init Called"));
If you look at your OutputLog inside the Engine you know the exact point when its called. But if you dont need the function you can delete it.
Edit: I just noticed in the Tutorial it does never show how to Set the Component.In your Constructor:
GetCharacterMovement() = CreateDefaultSubobject<UCustomMovementComponent>(ACharacter::CharacterMovementComponentName);
GetCharacterMovement()->UpdatedComponent = GetCapsuleComponent();
CrouchedEyeHeight = GetCharacterMovement()->CrouchedHalfHeight * 0.80f;
Same way as it is Set in the ACharacter. Use the Cast to access your Specific Typed UCustomMovementComponent.
Good Luck and have Fun =)