x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

NULL CharacterMovement component when switching from custom back to default

NULL CharacterMovement component when switching from custom back to default

Build Type: Binary

Build Version: Version: 4.17.2-3658906+++UE4+Release-4.17

When using a custom CharacterMovementComponent for the ACharacter class, downgrading to a default CharacterMovementComponent later will break existing blueprints that use the character. After switcing up the constructor arguments and reloading the project, the character blueprints will have a NULL MovementComponent that can not be fixed (since it's a private, inherited component).

Repro steps:

  • Start with ShooterGame template project

  • View the PlayerPawn blueprint in the editor and notice how it has a valid CharacterMovementComponent

  • Edit the source code for AShooterCharacter::AShooterCharacter:

Change this code:

AShooterCharacter::AShooterCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass (ACharacter::CharacterMovementComponentName))
{

To this:

AShooterCharacter::AShooterCharacter(const FObjectInitializer& ObjectInitializer)
{

This code change should make the ShooterCharacter use the standard UCharacterMovementComponent instead of the derived UShooterCharacterMovement

  • Compile the code and go back to the editor

  • View the PlayerPawn blueprint and notice that it still has a valid CharacterMovementComponent

  • Close the editor

  • Reopen the project in the editor

  • View the PlayerPawn blueprint -- It doesn't have a CharacterMovementComponent!

  • Run the game -- It crashes due to NULL component

  • These constructor initializers also produce a NULL movement component:

: Super(ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName))

  • Note that, while the PlayerPawn blueprint is in its bugged state, you can create a new blueprint that uses the ShooterCharacter as its parent. This new blueprint will have a valid, non-null movement component.

Product Version: UE 4.17
Tags:
more ▼

asked Oct 15 '17 at 11:21 PM in C++ Programming

avatar image

tlaelgames
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question