I noticed that when my custom movement component is working, my character class no longer has a “Character Movement Component”. I’m pretty sure the is is the cause, but I cant understand why the controller disappears.
I found this in the log but I cant figure out what it means.
LogLinker:Error: Failed import: class 'CharacterMovementComponent' name 'CharMoveComp' outer 'Default__MyCharacter_C'. There is another object (of 'pXCharMovementComponent' class) at the path.
LogLinker:Error: Failed import: class 'CharacterMovementComponent' name 'CharMoveComp' outer 'Default__MyCharacter_C'. There is another object (of 'pXCharMovementComponent' class) at the path.
LogLinker:Error: Failed import: class 'CharacterMovementComponent' name 'CharMoveComp' outer 'Default__MyCharacter_C'. There is another object (of 'pXCharMovementComponent' class) at the path.
So I installed the engine from github and started debugging
AProjectXCharacter::AProjectXCharacter(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
These two are after InternalConstructor and ConstructObject (respectively) have finished running
![default-post-internal-constructor.PNG|796x860](upload://iby4eZb4d5lYvB10LeLeWSkex4U.png)
![default-post-construct-object.PNG|796x858](upload://gLiiKT2AkH0BcwHdVZXsogOoWaP.png)
The CharacterMovement contains a value in both Autos windows
Then the same again where the only change in the entire code base
AProjectXCharacter::AProjectXCharacter(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName)) //: Super(PCIP)
![934c9c0ee51b2cbdf091cdf4f216505ba9980ff5.png|791x841](upload://l14k3qpCgTCa2AX7468qU5yIe2x.png)
![96596236bc8ee32a83d0b7faa692d53b9e5f49f7.png|795x860](upload://ls37HegWkuea8WNkxj0TrJd7ypF.png)
You can see that the internal constructor correctly created the movement component but it gets lost when returning it all to the SpawnActor function.
I'm now completely at the limit of my knowledge. Is this a bug in the engine or have I done something wrong?
I’m guessing that you are using a Blueprint as your actual character type? I ran into the same issue with 4.2, where I have a Blueprint of my custom Character, using the default CharacterMovementComponent, and when I updated my Character to use a custom CharacterMovementComponent, the existing Blueprint didn’t work correctly anymore.
My solution was to create a new Blueprint, exactly like the original, after implementing the new CharacterMovementComponent.
I saw some discussion about this elsewhere, and IIRC, someone already submitted a patch to the UnrealEngine project on GitHub to address it - so it shouldn’t be a problem in the next release.
Greetings. I have exactly the same issue with my movement component, but the following comment - “This (as well the issue with not being able to set the custom component class) has been fixed here.” - can’ t help me as the link behind it is not available anymore…
The link goes to the relevant line change in github. You need to be signed in and allowed to see the unrealengine source to see it. If you really are falling foul of this bug, the solution is to upgrade to unrealengine 4.3 or higher. Sorry thats probably not the answer you are looking for, but this is a 2 year old thread after all.
You are probably better off starting a new thread, listing out your own error messages and issues (like I did above) as your problem wont be the one discussed above.
I am running in the exact same problem. I was using a custom CharacterMovementComponent. As I no longer require it, I have removed it.
Now GetCharacterMovement() returns nullptr and I am no longer able to control the character in-game.
My setup: Custom C++ Character -> Blueprint Character based on C++.
Version 4.17.2
During looking for a solution I noticed that suddenly another completely unrelated Blueprint did no longer compile due to asset references. I never touched the assets.
Did you try to delete your character blueprint and recreate it as stated above? Blueprints simetimes cause problems when deleting, adding, renaming components etc.
Yes, I recreated the entire blueprint. Took me an hour to port everything over.
It should work more reliable in my opinion. This can be very frustrating.
If you re-created the Blueprint and you have the problem still, then the issue is likely still in the code. Blueprints can hold on to UPROPERTY()'s even if you remove them from the C++ class. It’s fine to add them, but taking them away or renaming objects often means you need to recreate the Blueprint or you might face all kinds of random issues.
The same is true for re-parenting. I would suggest checking the C++ again, then recreating your Blueprint.