[Crash] Cant Override Movement Component Twice, for a 2nd Character subclass, C++

Make sure you see this post at the bottom:

#Attempted Work around

trying to make the 2nd movement component class a subclass of my first extended movement comp class caused a terrifying complete and total OS freeze for several seconds and a frame rate of about 2 as the editor tried to load

I had to use CTRL + ALT + DEL to get my computer back

Rama


Dear Friends at Epic,

I am overriding the default Character movement component using this method:

AVictoryPlayerCharacterBase::AVictoryPlayerCharacterBase(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName))
{

I made a new type of character, a subclass of PlayerCharacterBase,

and I made new movement component, that was not a subclass of UVictoryCharMoveComp, but was a direct subclass of MovementComponent

So again, the inheritance:

Character->VictoryPlayerCharacterBase->NewCharClass

And NewCharClass tried to override the movement component a second time with:

ANewCharClass::ANewCharClass(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName))
{

Trying to override the movement component twice lead to this crash:

#The Crash

[2014.02.09-18.14.03:669][   ]LogWindows: Assertion failed: 0 [File:D:\BuildFarm\buildmachine_++depot+UE4-Rocket+Beta6\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2076]

Stack:
Address = 0xe0313156 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe020345a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe2b7a41f (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
FPostConstructInitializeProperties::FOverrides::Add() 0xd5e85d36 + 170 bytes [File=c:\program files\rocket\engine\source\runtime\coreuobject\public\uobject\uobjectglobals.h:818] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AVictoryPlayerCharacterBase::AVictoryPlayerCharacterBase() 0xd5e84536 + 102 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\victoryplayercharacterbase.cpp:34] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AEvolverBase::AEvolverBase() 0xd5e618f6 + 54 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\evolverbase.cpp:22] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AEvolver::AEvolver() 0xd5e596ce + 14 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\evolver.cpp:24] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AJoyMech::AJoyMech() 0xd5e9afd8 + 0 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\mechs\joymech.cpp:16] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
Address = 0xe2a3c0b4 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe2b87b7a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe2b7bb52 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe2a9eefa (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe012b895 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe021b2c0 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe028d17c (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe028dba2 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe01df049 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0x3f1911ab (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f194228 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f18e7dc (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f18e94a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f19a73b (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f19b3ef (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x76af652d (filename not found) [in C:\Windows\system32\kernel32.dll]
Address = 0x76d2c521 (filename not found) [in C:\Windows\SYSTEM32\ntdll.dll]
Address = 0x76d2c521 (filename not found) [in C:\Windows\SYSTEM32\ntdll.dll]


Address = 0xfce09e5d (filename not found) [in C:\Windows\system32\KERNELBASE.dll]
Address = 0xe0311a1c (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe021c8b2 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe02034ff (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe2b7a41f (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
FPostConstructInitializeProperties::FOverrides::Add() 0xd5e85d36 + 170 bytes [File=c:\program files\rocket\engine\source\runtime\coreuobject\public\uobject\uobjectglobals.h:818] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AVictoryPlayerCharacterBase::AVictoryPlayerCharacterBase() 0xd5e84536 + 102 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\victoryplayercharacterbase.cpp:34] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AEvolverBase::AEvolverBase() 0xd5e618f6 + 54 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\evolverbase.cpp:22] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AEvolver::AEvolver() 0xd5e596ce + 14 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\evolver.cpp:24] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
AJoyMech::AJoyMech() 0xd5e9afd8 + 0 bytes [File=e:\rocketvictory\victorygame\source\victorygame\private\characters\mechs\joymech.cpp:16] [in E:\RocketVictory\VictoryGame\Binaries\Win64\RocketEditor-VictoryGame.dll]
Address = 0xe2a3c0b4 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe2b87b7a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe2b7bb52 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe2a9eefa (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-CoreUObject.dll]
Address = 0xe012b895 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe021b2c0 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe028d17c (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe028dba2 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe01df049 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0x3f1911ab (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f194228 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f18e7dc (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f18e94a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f19a73b (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3f19b3ef (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x76af652d (filename not found) [in C:\Windows\system32\kernel32.dll]
Address = 0x76d2c521 (filename not found) [in C:\Windows\SYSTEM32\ntdll.dll]
Address = 0x76d2c521 (filename not found) [in C:\Windows\SYSTEM32\ntdll.dll]

#Attempted Work around

trying to make the 2nd movement component class a subclass of my first extended movement comp class caused a terrifying complete and total OS freeze for several seconds and a frame rate of about 2 as the editor tried to load

I had to use CTRL + ALT + DEL to get my computer back

Rama

You must subclass UCharacterMovementComponent for a Character’s movement. You cannot inherit directly from UMovementComponent.

I will enter a TTP for that to provide a useful error message when crashing instead of just crashing out with no information.

Lovely to hear from you Marc!

Sorry I typed it wrong I was subclass charactermovement

// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "VictoryCharMoveComp.generated.h"

class AVictoryPlayerCharacterBase;
class AVictoryGamePlayerController;
 
UCLASS(dependson=UVictoryCore)
class UVictoryCharMoveComp : public UCharacterMovementComponent
{
	GENERATED_UCLASS_BODY()

	
//Core
public:
	AVictoryGamePlayerController* VictoryPC;
	FORCEINLINE void GetVictoryPC()
	{
		//Victory PC
		TObjectIterator Itr;
		if (Itr) VictoryPC = *Itr; 
	}
	

protected:
	
	virtual void AdjustFloorHeight() OVERRIDE;
	
	
	//Init
	virtual void InitializeComponent() OVERRIDE;
	
	//Tick
	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) OVERRIDE;
};

#Repro

I copied the above class and made a new char movecomponent from this

  • so I had two sublcasses of UCharacterMovementComponent
  • I had a character inheritance of ACharacter->CharBase->Newchar
  • CharBase used the first subclass of UCharacterMovementComponent
  • Newchar used the 2nd subclass of UCharacterMovementComponent
  • this is where the crash comes in

If you can repro this without crashes let me know (if you have time to)

I hope you are having fun!

#:heart:

Rama

Reading more closely your attempted workaround is the correct behavior. Because your CharBase class assumes it will have the first subclass of CharMovementComponent any subsequent subclasses must not break that assumption. Having parallel hierarchies of ACharacter->CharBase->NewChar and UCharacterMovementComponent->first subclass->second subclass is what will be required.

I can only imagine/hope the lock up was random and not related to this inheritance.

Ahh okay, thanks Marc!


The lock up was due to the Editor resolution somehow magically being set to something ridiculously high like 5766xsomething

I have no idea why this chose to happen when I was only doing c++ testing,

but deleting my Saved/Config directory fixed that lock up

:slight_smile:

Thanks for caring!

Rama

Can someone explain how the following code overrides the component? PCIP.SetDefaultSubobjectClass(ACharacter::CharacterMovementComponentName)

I’ve been racking my brain trying to figure out how to do this.

Thank you in advance!!

Brumsky