I’ve been making my own version of the ACharacter and UCharacterMovementComponent classes by pasting contents and changing variable names. At some point I started suffering with the above linker error, which I’ve found other people have stumbled across in this post: here
The problem was related to the use of the FRootMotionMovementParams structure in my copied code (i.e. commenting it out, removed the issue). Looking at the declaration in AnimationAsset.h, I suspect that an insertion of the ENGINE_API macro may solve the issue for me, but I don’t want to change the source code.
Fortunately, root motion isn’t crucial for my project, but it would be nice if this could be rectified so that I easily had the option in future.
Can you explain what code you were copying and where you ran into the linker error? Depending on the code being copied/used this seems to be expected behavior. RootMotion is not included by default in order to improve overall compile times, and can be included as necessary. Additionally, if the code being copied contains Editor-Only code, this will cause the project to be unable to package as well. Because of this, it may be best to extend the Character & CharacterMovementComponent classes with the functionality you need for your project rather than trying to copy/recreate them.
(Note, the function called on the FRootMotionMovementParams structure is almost arbitrary, but needs to be a function that involves RootMotionScale somehow. For example, Clear() doesn’t cause a problem, while the above mentioned function and Accumulate both do (plus likely more)).
have reproduced this issue and logged a report for it here Unreal Engine Issues and Bug Tracker (UE-40452) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.
The targeted fix says 4.16, but would it be possible to get it into 4.15 still? I have been unable to use my root motion based code since 4.14 and my currently used hotfix is rather unstable.
I am unable to use a custom build of the engine so I cannot implement possible fixes myself.
The bug tracker mentions that removing the static from the declaration fixes it, but it can also be fixed by changing the code to:
static ENGINE_API FVector RootMotionScale;
As suggested by the original poster as well as an answer to my question for 4.13.
Unfortunately it won’t be possible to get this fix included in time for the 4.15 release, however I have added a note to the original report to indicate the ENGINE_API fix as well as suggest including a fix for this issue in a hotfix.