Error loading my project

Here is the crash I’m experiencing, and I can’t figure out why, can someone help me please ?

LoginId:caf8e5ee4decab0b4daf8585ceca98eb
EpicAccountId:631950fa72ec415daddfbcd1a0170b6c

Fatal error: [File:D:\Build++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2581] UObject(const FObjectInitializer&) constructor called but it’s not the object that’s currently being constructed with NewObject. Maybe you are trying to construct it on the stack, which is not supported.

UE4Editor_Core!FDebug::AssertFailed() [d:\build++ue4\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:417]
UE4Editor_CoreUObject!UObject::UObject() [d:\build++ue4\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:2582]
UE4Editor_Engine!UAnimationAsset::UAnimationAsset() [d:\build++ue4\sync\engine\source\runtime\engine\private\animationasset.cpp:182]
UE4Editor_Engine!UAnimSequenceBase::UAnimSequenceBase() [d:\build++ue4\sync\engine\source\runtime\engine\private\animation\animsequencebase.cpp:20]
UE4Editor_Engine!UAnimCompositeBase::UAnimCompositeBase() [d:\build++ue4\sync\engine\source\runtime\engine\private\animation\animcompositebase.cpp:711]
UE4Editor_Engine!UAnimMontage::UAnimMontage() [d:\build++ue4\sync\engine\source\runtime\engine\private\animation\animmontage.cpp:37]
UE4Editor_TacticalOps!ABaseCharacter::ABaseCharacter() [c:\users\bigred\documents\unreal projects acticalops\source acticalops\player\basecharacter.cpp:20]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() [d:\build++ue4\sync\engine\source\runtime\coreuobject\private\uobject\class.cpp:3019]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() [d:\build++ue4\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:793]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\build++ue4\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:867]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\build++ue4\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:813]
UE4Editor_Core!TBaseMulticastDelegate<void>::Broadcast() [d:\build++ue4\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:974]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\build++ue4\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:510]
UE4Editor_Projects!FModuleDescriptor::LoadModulesForPhase() [d:\build++ue4\sync\engine\source\runtime\projects\private\moduledescriptor.cpp:593]
UE4Editor_Projects!FProjectManager::LoadModulesForProject() [d:\build++ue4\sync\engine\source\runtime\projects\private\projectmanager.cpp:63]
UE4Editor!FEngineLoop::LoadStartupModules() [d:\build++ue4\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2897]
UE4Editor!FEngineLoop::PreInit() [d:\build++ue4\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2310]
UE4Editor!GuardedMain() [d:\build++ue4\sync\engine\source\runtime\launch\private\launch.cpp:135]
UE4Editor!GuardedMainWrapper() [d:\build++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:145]
UE4Editor!WinMain() [d:\build++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:276]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
kernel32
ntdll

Your “ABaseCharacter” is trying to load an animation montage or some such in the constructor, which isn’t allowed. Can you post the code in ABaseCharacter::ABaseCharacter()?

Oh !
thanx for the help.

Here is my code :


// Fill out your copyright notice in the Description page of Project Settings.

#include "BaseCharacter.h"
#include "Items/Ammo/Ammo.h"
#include "TacticalOps.h"
#include "Game/BaseGameMode.h "
#include "Components/CapsuleComponent.h"

FOnBaseCharacterEquipWeapon ABaseCharacter::NotifyEquipWeapon;
FOnBaseCharacterUnEquipWeapon ABaseCharacter::NotifyUnEquipWeapon;

// Vault
#define VAULT_SWEEP_DIST 20.f
#define VAULT_SWEEP_SPHERE_RADIUS 20.f
#define MIN_VAULT_HEIGHT 70.f
#define MAX_VAULT_HEIGHT 130.f

// Sets default values
ABaseCharacter::ABaseCharacter(const FObjectInitializer & ObjectInitializer) :Super(ObjectInitializer)
{
Mesh1P = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("PawnMesh1P"));
Mesh1P->SetupAttachment(GetCapsuleComponent());
Mesh1P->bOnlyOwnerSee = true;
Mesh1P->bOwnerNoSee = false;
Mesh1P->bCastDynamicShadow = false;
Mesh1P->bReceivesDecals = false;
Mesh1P->VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::OnlyTickPoseWhenRendered;
Mesh1P->PrimaryComponentTick.TickGroup = TG_PrePhysics;
Mesh1P->SetCollisionObjectType(ECC_Pawn);
Mesh1P->SetCollisionEnabled(ECollisionEnabled::NoCollision);
Mesh1P->SetCollisionResponseToAllChannels(ECR_Ignore);

GetMesh()->bOnlyOwnerSee = false;
GetMesh()->bOwnerNoSee = true;
GetMesh()->bReceivesDecals = false;
GetMesh()->SetCollisionObjectType(ECC_Pawn);
GetMesh()->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
//GetMesh()->SetCollisionResponseToChannel(COLLISION_WEAPON, ECR_Block);
//GetMesh()->SetCollisionResponseToChannel(COLLISION_PROJECTILE, ECR_Block);
GetMesh()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);

//GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore);
//GetCapsuleComponent()->SetCollisionResponseToChannel(COLLISION_PROJECTILE, ECR_Block);
//GetCapsuleComponent()->SetCollisionResponseToChannel(COLLISION_WEAPON, ECR_Ignore);



}


void ABaseCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents();

if (Role == ROLE_Authority)
{
Health = HealthMax;
SpawnDefaultInventory();
}
// play respawn effects
if (GetNetMode() != NM_DedicatedServer)
{
/*if (RespawnFX)
{
UGameplayStatics::SpawnEmitterAtLocation(this, RespawnFX, GetActorLocation(), GetActorRotation());
}

if (RespawnSound)
{
UGameplayStatics::PlaySoundAtLocation(this, RespawnSound, GetActorLocation());
}*/
}
}

// Called when the game starts or when spawned
void ABaseCharacter::BeginPlay()
{
Super::BeginPlay();


}

void ABaseCharacter::Destroyed()
{
Super::Destroyed();
DestroyInventory();
}

///////////////////////////////////////////////////////
//inventory

void ABaseCharacter::AddPickable(APickable* Picked)
{
if (Picked ) //&& Role == ROLE_Authority a definir plus tard
{
if (ABaseWeapon* weapon = Cast <ABaseWeapon>(Picked))
{
AddWeapon(weapon);
}
else {
Picked->OnEnterInventory(this);
Inventory.AddUnique(Picked);
CurrentInventoryWeight = CurrentInventoryWeight + Picked->Weight;
Picked->IsPickable = false;
}
}
}

void ABaseCharacter::AddWeapon(ABaseWeapon* weapon)
{
if (weapon->WeapKind == EWeaponKind::SideGun)
{
if (SideGun == NULL)
{
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
SideGun = weapon;
weapon->CurrentSlot = EWeaponSlot::SideGun;
if (CurrentWeapon == NULL)
{
EquipSideGun();
}

}
else
{
RemoveWeapon(SideGun);
ThrowPickable(SideGun);
SideGun = NULL;
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
SideGun = weapon;
weapon->CurrentSlot = EWeaponSlot::SideGun;
EquipSideGun();
}

}
else
if (weapon->WeapKind == EWeaponKind::Shotgun || weapon->WeapKind == EWeaponKind::Rifle || weapon->WeapKind == EWeaponKind::SMG)
{
if (PrimaryWeapon == NULL)
{
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
PrimaryWeapon = weapon;
weapon->CurrentSlot = EWeaponSlot::Primary;
if (CurrentWeapon != NULL)
{
}
else EquipPrimary();
return;
}
if (PrimaryWeapon != NULL && SecondaryWeapon == NULL)
{
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
SecondaryWeapon = weapon;
weapon->CurrentSlot = EWeaponSlot::Secondary;
}
if (PrimaryWeapon != NULL && SecondaryWeapon != NULL)
{
if (CurrentWeapon == PrimaryWeapon)
{
RemoveWeapon(PrimaryWeapon);
ThrowPickable(PrimaryWeapon);
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
PrimaryWeapon = weapon;
weapon->CurrentSlot = EWeaponSlot::Primary;
}

if (CurrentWeapon == SecondaryWeapon)
{
RemoveWeapon(SecondaryWeapon);
ThrowPickable(SecondaryWeapon);
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
SecondaryWeapon = weapon;
weapon->CurrentSlot = EWeaponSlot::Secondary;

}
else
RemoveWeapon(PrimaryWeapon);
ThrowPickable(PrimaryWeapon);
weapon->OnEnterInventory(this);
Inventory.AddUnique(weapon);
PrimaryWeapon = weapon;
weapon->CurrentSlot = EWeaponSlot::Primary;
}
}
weapon->IsPickable = false;
}

bool ABaseCharacter::CanAddInventory(APickable* PickableToAdd)
{
if (PickableToAdd)
{
float Pickableweight = PickableToAdd->Weight;
if (ABaseWeapon* weapon = Cast <ABaseWeapon>(PickableToAdd))
{
return true;

}
else
{
if (Pickableweight + CurrentInventoryWeight < MaxInventoryWeight)
return true;
}

}
return false;
}


void ABaseCharacter::EquipWeapon( EWeaponSlot weaponslot)
{


if (Role == ROLE_Authority)
{




switch (weaponslot)
{
case (EWeaponSlot::Primary):
if (PrimaryWeapon != NULL)
{
CurrentWeapon = PrimaryWeapon;
CurrentWeapon->OnEquip(CurrentWeapon);

}
break;

case (EWeaponSlot::Secondary):
if (SecondaryWeapon != NULL)
{
CurrentWeapon = SecondaryWeapon;
CurrentWeapon->OnEquip(CurrentWeapon);

}
break;
case (EWeaponSlot::SideGun):
if (SideGun != NULL)
{
CurrentWeapon = SideGun;
CurrentWeapon->OnEquip(CurrentWeapon);

}
break;

}
}

else
{
ServerEquipWeapon( weaponslot);
}

}

bool ABaseCharacter::ServerEquipWeapon_Validate(EWeaponSlot weaponslot)
{
return true;
}

void ABaseCharacter::ServerEquipWeapon_Implementation( EWeaponSlot weaponslot)
{
EquipWeapon( weaponslot);
}

void ABaseCharacter::DestroyInventory()
{
if (Role < ROLE_Authority)
{
return;
}

// remove all weapons from inventory and destroy them
for (int32 i = Inventory.Num() - 1; i >= 0; i--)
{
APickable* Weapon = Inventory*;
if (Weapon)
{
//RemovePickable(Weapon);
Weapon->Destroy();
}
}
}

void ABaseCharacter::RemoveWeapon(class ABaseWeapon* weapon)
{
if (weapon && Role == ROLE_Authority)
{
weapon->OnLeaveInventory();
Inventory.RemoveSingle(weapon);
}
}

//on jette sur le sol l'objet dont on ne veut plus
void ABaseCharacter::ThrowPickable(APickable* PickableThrow)
{
PickableThrow->IsPickable = true;
//A compléter
}



void ABaseCharacter::SpawnDefaultInventory()
{
if (Role < ROLE_Authority)
{
return;
}

int32 NumWeaponClasses = DefaultInventoryClasses.Num();
for (int32 i = 0; i < NumWeaponClasses; i++)
{
if (DefaultInventoryClasses*)
{
FActorSpawnParameters SpawnInfo;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
ABaseWeapon* NewWeapon = GetWorld()->SpawnActor<ABaseWeapon>(DefaultInventoryClasses*, SpawnInfo);
AddWeapon(NewWeapon);
}
}
}




void ABaseCharacter::EquipPrimary()
{
if (CurrentWeapon != PrimaryWeapon && PrimaryWeapon != NULL)
{//si current weapon n'est pas nul alors il faut déséquiper currrentweapon
if (CurrentWeapon!=NULL)
{
//EWeaponSlot SlotToDesequip=CurrentWeapon->CurrentSlot;
UnequipWeapon(CurrentWeapon);

EquipWeapon(EWeaponSlot::Primary);
}

else
{
EquipWeapon(EWeaponSlot::Primary);
}

}

}


void ABaseCharacter::EquipSecondary()
{
if (CurrentWeapon != SecondaryWeapon && SecondaryWeapon != NULL)
{//si current weapon n'est pas nul alors il faut déséquiper currrentweapon
if (CurrentWeapon != NULL)
{
EWeaponSlot SlotToDesequip = CurrentWeapon->CurrentSlot;
//UnequipWeapon();

EquipWeapon(EWeaponSlot::Secondary);
}

else
{
EquipWeapon(EWeaponSlot::Secondary);
}

}

}
void ABaseCharacter::EquipSideGun()
{

}
void ABaseCharacter::EquipThrowable()
{

}


void ABaseCharacter::OnNextWeapon()
{
if (CurrentWeapon != NULL)
{
switch (CurrentWeapon->CurrentSlot)
{
case (EWeaponSlot::Primary):
if (SecondaryWeapon != NULL)
{
UnequipWeapon(PrimaryWeapon);
EquipSecondary();
return;
}
if (SideGun != NULL)
{
UnequipWeapon(PrimaryWeapon);
EquipSideGun();
return;
}

if (Throwable!=NULL)
{
UnequipWeapon(PrimaryWeapon);
EquipThrowable();
}
break;

case(EWeaponSlot::Secondary):
if (SideGun != NULL)
{
UnequipWeapon(SecondaryWeapon);
EquipSideGun();
return;
}

if (Throwable != NULL)
{
UnequipWeapon(SecondaryWeapon);
EquipThrowable();
}
if (PrimaryWeapon != NULL)
{
UnequipWeapon(SecondaryWeapon);
EquipPrimary();
return;
}
break;

}

}
else
if (PrimaryWeapon != NULL)
{
EquipPrimary();
}
}


void ABaseCharacter::OnPreviousWeapon()
{
if (CurrentWeapon != NULL)
{
switch (CurrentWeapon->CurrentSlot)
{
case (EWeaponSlot::Primary):

if (Throwable != NULL)
{
EquipThrowable();
}
break;
if (SideGun != NULL)
{
EquipSideGun();
return;
}
if (SecondaryWeapon != NULL)
{
EquipSecondary();
return;
}





}
}

}


void ABaseCharacter::UnequipWeapon(ABaseWeapon* WeaponToUnequip)
{
if (CurrentWeapon != NULL)
{

CurrentWeapon->OnUnEquip();
CurrentWeapon = NULL;
}
}

/////////////////////////////////////////////////////////
//Replication


void ABaseCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);

DOREPLIFETIME_CONDITION(ABaseCharacter, Inventory,COND_OwnerOnly);
//DOREPLIFETIME(ABaseCharacter, DefaultInventoryClasses);
DOREPLIFETIME(ABaseCharacter, CurrentWeapon);
DOREPLIFETIME(ABaseCharacter,PrimaryWeapon );
DOREPLIFETIME(ABaseCharacter, SecondaryWeapon);
DOREPLIFETIME(ABaseCharacter, SideGun);
DOREPLIFETIME(ABaseCharacter, Health);

}

void ABaseCharacter::OnRep_CurrentWeapon(class ABaseWeapon* LastWeapon)
{

LastWeapon->SetOwningPawn(this);
}


//////////////////////////////////////////////////////
//Inputs


// Called to bind functionality to input
void ABaseCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);

check(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &ABaseCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveForward", this, &ABaseCharacter::MoveRight);
PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
PlayerInputComponent->BindAxis("TurnRate", this, &ABaseCharacter::TurnAtRate);
PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
PlayerInputComponent->BindAxis("LookUpRate", this, &ABaseCharacter::LookUpAtRate);

PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ABaseCharacter::Jump);
PlayerInputComponent->BindAction("Jump", IE_Released, this, &ABaseCharacter::StopJumping);
//PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &ABaseCharacter::Crouch);
//PlayerInputComponent->BindAction("Crouch", IE_Released, this, &ABaseCharacter::StopCrouching);

PlayerInputComponent->BindAction("FireMode", IE_Pressed, this, &ABaseCharacter::ChangeFireMode);
PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &ABaseCharacter::Fire);
PlayerInputComponent->BindAction("Reload", IE_Pressed, this, &ABaseCharacter::Reload);

PlayerInputComponent->BindAction("NextWeapon", IE_Pressed, this, &ABaseCharacter::OnNextWeapon);
PlayerInputComponent->BindAction("PreviousWeapon", IE_Pressed, this, &ABaseCharacter::OnPreviousWeapon);
PlayerInputComponent->BindAction("EquipPrimary", IE_Pressed, this, &ABaseCharacter::EquipPrimary);
PlayerInputComponent->BindAction("EquipSecondary", IE_Pressed, this, &ABaseCharacter::EquipSecondary);
}




void ABaseCharacter::MoveForward(float Val)
{
if (Controller && Val != 0.f)
{
// Limit pitch when walking or falling
const bool bLimitRotation = (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling());
const FRotator Rotation = bLimitRotation ? GetActorRotation() : Controller->GetControlRotation();
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
AddMovementInput(Direction, Val);
}
}


void ABaseCharacter::MoveRight(float Val)
{
if (Val != 0.f)
{
const FQuat Rotation = GetActorQuat();
const FVector Direction = FQuatRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
AddMovementInput(Direction, Val);
}
}

void ABaseCharacter::TurnAtRate(float Val)
{
// calculate delta for this frame from the rate information
AddControllerYawInput(Val * BaseTurnRate * GetWorld()->GetDeltaSeconds());
}

void ABaseCharacter::LookUpAtRate(float Val)
{
// calculate delta for this frame from the rate information
AddControllerPitchInput(Val * BaseLookUpRate * GetWorld()->GetDeltaSeconds());
}





void ABaseCharacter::Jump()
{
FCollisionQueryParams QueryParams;
QueryParams.AddIgnoredActor(this);

const float CapsuleHalfHeight = GetCapsuleComponent()->GetScaledCapsuleHalfHeight();
const float CapsuleRadius = GetCapsuleComponent()->GetScaledCapsuleRadius();
const FVector ForwardVector = GetActorForwardVector();
const FVector SweepStart = GetActorLocation() + FVector(0.f, 0.f, CapsuleHalfHeight) + ForwardVector * (CapsuleRadius + VAULT_SWEEP_DIST);
const FVector SweepEnd = SweepStart - FVector(0.f, 0.f, CapsuleHalfHeight * 2.f);

FHitResult Hit;
if (GetWorld()->SweepSingleByChannel(Hit, SweepStart, SweepEnd, FQuat::Identity, ECC_Pawn, FCollisionShape::MakeSphere(VAULT_SWEEP_SPHERE_RADIUS), QueryParams))
{
const float ObstacleHeight = Hit.ImpactPoint.Z - SweepEnd.Z;
if (ObstacleHeight > MIN_VAULT_HEIGHT && ObstacleHeight < MAX_VAULT_HEIGHT)
{
Vault();
return;
}
}

Super::Jump();


}

void ABaseCharacter::Vault()
{
//PlayAnimMontage(VaultMontage);
}






bool ABaseCharacter::IsFirstPerson() const
{
return IsAlive() && Controller && Controller->IsLocalPlayerController();
}

bool ABaseCharacter::IsAlive() const
{
return Health > 0;
}



USkeletalMeshComponent* ABaseCharacter::GetPawnMesh() const
{
return IsFirstPerson() ? Mesh1P : GetMesh();
}



USkeletalMeshComponent* ABaseCharacter::GetSpecifcPawnMesh(bool WantFirstPerson) const
{

return WantFirstPerson == true ? Mesh1P : GetMesh();
}



FName ABaseCharacter::GetWeaponAttachPoint() const
{
return WeaponAttachPoint;
}


/////////////////////////////////////////////////////
//Damage



float ABaseCharacter::TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser)
{


if (Health <= 0.f)
{
return 0.f;
}

// Modify based on game rules.
ABaseGameMode* const Game = GetWorld()->GetAuthGameMode<ABaseGameMode>();
Damage = Game ? Game->ModifyDamage(Damage, this, DamageEvent, EventInstigator, DamageCauser) : 0.f;

const float ActualDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
if (ActualDamage > 0.f)
{
Health -= ActualDamage;
if (Health <= 0)
{
Die(ActualDamage, DamageEvent, EventInstigator, DamageCauser);
}
/*else
{
PlayHit(ActualDamage, DamageEvent, EventInstigator ? EventInstigator->GetPawn() : NULL, DamageCauser);
}

MakeNoise(1.0f, EventInstigator ? EventInstigator->GetPawn() : this);*/
}

return ActualDamage;
}



bool ABaseCharacter::Die(float KillingDamage, FDamageEvent const& DamageEvent, AController* Killer, AActor* DamageCauser)
{
/*if (!CanDie(KillingDamage, DamageEvent, Killer, DamageCauser))
{
return false;
}*/

Health = FMath::Min(0.0f, Health);

// if this is an environmental death then refer to the previous killer so that they receive credit (knocked into lava pits, etc)
/*UDamageType const* const DamageType = DamageEvent.DamageTypeClass ? DamageEvent.DamageTypeClass->GetDefaultObject<UDamageType>() : GetDefault<UDamageType>();
Killer = GetDamageInstigator(Killer, *DamageType);

AController* const KilledPlayer = (Controller != NULL) ? Controller : Cast<AController>(GetOwner());
GetWorld()->GetAuthGameMode<AShooterGameMode>()->Killed(Killer, KilledPlayer, this, DamageType);

NetUpdateFrequency = GetDefault<AShooterCharacter>()->NetUpdateFrequency;
GetCharacterMovement()->ForceReplicationUpdate();

OnDeath(KillingDamage, DamageEvent, Killer ? Killer->GetPawn() : NULL, DamageCauser);*/
return true;
}





//////////////////////////////////////////////////////////////////////////
// Animations

float ABaseCharacter::PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate, FName StartSectionName)
{
USkeletalMeshComponent* UseMesh = GetPawnMesh();
if (AnimMontage && UseMesh && UseMesh->AnimScriptInstance)
{
return UseMesh->AnimScriptInstance->Montage_Play(AnimMontage, InPlayRate);
}

return 0.0f;
}

void ABaseCharacter::StopAnimMontage(class UAnimMontage* AnimMontage)
{
USkeletalMeshComponent* UseMesh = GetPawnMesh();
if (AnimMontage && UseMesh && UseMesh->AnimScriptInstance &&
UseMesh->AnimScriptInstance->Montage_IsPlaying(AnimMontage))
{
UseMesh->AnimScriptInstance->Montage_Stop(AnimMontage->BlendOut.GetBlendTime(), AnimMontage);
}
}

void ABaseCharacter::StopAllAnimMontages()
{
USkeletalMeshComponent* UseMesh = GetPawnMesh();
if (UseMesh && UseMesh->AnimScriptInstance)
{
UseMesh->AnimScriptInstance->Montage_Stop(0.0f);
}
}



//////////////////////////////////////////////////////////////////////
//Fire and weapons management


void ABaseCharacter::Fire()
{

if (CanFire())
{
if (Role == ROLE_Authority)
{

TriggerPulled = true;
CurrentWeapon->WeaponFire(true);

}
else ServerFire();
}

}

void ABaseCharacter::OnStopFire()
{
TriggerPulled = false;
CurrentWeapon->WeaponFire(false);
}


bool ABaseCharacter::CanFire()
{
if (CurrentWeapon != NULL && !IsReloading && CurrentWeapon->GetIsEquiped())
{
return true;
}

else return false;
}

bool ABaseCharacter::ServerFire_Validate()
{
return true;
}

void ABaseCharacter::ServerFire_Implementation()
{
Fire();
}


void ABaseCharacter::ChangeFireMode()
{
if (CurrentWeapon != NULL)
{
CurrentWeapon->SetCurrentFireMode();
}
}



int8 ABaseCharacter::GetAmmo(EAmmoKind Ammo)
{
int8 AmmoToReturn = 0;

for (int32 i = Inventory.Num() - 1; i >= 0; i--)
{
APickable* Ammotocheck = Inventory*;
if (AAmmo* ItemTocheck = Cast<AAmmo>(Ammotocheck))
{
if (ItemTocheck != NULL && ItemTocheck->AmmoType == Ammo)

{
AmmoToReturn = ItemTocheck->AmmoCount;
if (CurrentWeapon->HasFastExtandedMag)
{
ItemTocheck->GetAmmo(CurrentWeapon->MaxAmmoWithExtandedMag);

}
else
{
ItemTocheck->GetAmmo(CurrentWeapon->MaxAmmo);
}
}
}
}
return AmmoToReturn;
}


void ABaseCharacter::Reload()
{
if (Role == ROLE_Authority)
{
if (CurrentWeapon != NULL)
{
IsReloading = true;
CurrentWeapon->WeaponReload();
IsReloading = false;
}
}
else ServerReload();

}

bool ABaseCharacter::ServerReload_Validate()
{
return true;
}

void ABaseCharacter::ServerReload_Implementation()
{
Reload();
}


I’m not sure what is going on, but try


Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("PawnMesh1P")); 

on the first line of your constructor. It’s just a wild guess.

Btw, please wrap your code with the code tags (select your code, click on the underlined A at the top right corner to open the “advanced editor” and then on the #).

Hi tryed what you said but didn’t worked.
Oh I also wrapped the code, sorry for that !

Are you sure the problem is in the charaacter class ?

As you can see here



UE4Editor_TacticalOps!ABaseCharacter::ABaseCharacter() [c:\users\bigred\documents\unreal projects	acticalops\source	acticalops\player\basecharacter.cpp:20]


Your constructor is called and then it calls some other functions until it crashes.

This is kinda weird because the constructor of your character is called and then the constructor of an AnimMontage is called, but without any other functions in between. It’s like you’re calling AnimMontage() or new AnimMontage() directly from within ABaseCharacter’s constructor (and from what I can see in your code, this is not something you’re doing).

From which classes does ABaseCharacter derive?

You should set a breakpoint at the beginning of your constructor, open the editor and quickly attach Visual Studio to the editor, so when the editor crashes you can find out which line of your constructor is causing the crash (after the exception is thrown, open the callstack window in VS and double click your constructor in it, it should take you to the line that is calling the function that causes the crash).

BaseCharacter deives directly from ACharacter as you can see here

This is very weird because I can’t see any animmontage() called in my constructor.

I will try what you said , but never done that before, so I hope it isn’t too complicated.

Thanx for your help anyway


// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

//#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Net/UnrealNetwork.h"
#include "Items/Pickable.h"
#include "Items/BaseWeapon.h"
#include "BaseCharacter.generated.h"

class ABaseWeapon;
class APickable;

DECLARE_MULTICAST_DELEGATE_TwoParams(FOnBaseCharacterEquipWeapon, ABaseCharacter*, APickable* /* new */);
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnBaseCharacterUnEquipWeapon, ABaseCharacter*, APickable* /* old */);


UCLASS(Abstract)
class  ABaseCharacter : public ACharacter
{
    GENERATED_UCLASS_BODY()

        /** Global notification when a character equips a weapon. Needed for replication graph. */
        TACTICALOPS_API static FOnBaseCharacterEquipWeapon NotifyEquipWeapon;

        /** Global notification when a character un-equips a weapon. Needed for replication graph. */
    TACTICALOPS_API static FOnBaseCharacterUnEquipWeapon NotifyUnEquipWeapon;

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:    
    // Called every frame
    //virtual void Tick(float DeltaTime) override;

    void DestroyInventory();

    void Destroyed();

    /** spawn inventory, setup initial variables */
    virtual void PostInitializeComponents() override;

    // Called to bind functionality to input
    virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

    ////////////////////////////////////////////////
    //Inventory
    /** weapons in inventory */
public:

    UPROPERTY(BluePrintReadWrite,Transient, Replicated)
        TArray<class APickable*> Inventory;

    /** default inventory list */
    UPROPERTY(EditDefaultsOnly, Category = Inventory)
        TArray<TSubclassOf<class ABaseWeapon> > DefaultInventoryClasses;

    /** currently equipped weapon */
    UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
        class ABaseWeapon* CurrentWeapon;

    UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
        class ABaseWeapon* PrimaryWeapon;

    UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
        class ABaseWeapon* SecondaryWeapon;

    UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
        class ABaseWeapon* SideGun;

    UPROPERTY(BluePrintReadWrite, Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
        class ABaseWeapon* Throwable;


    void RemoveWeapon(class ABaseWeapon* weapon);

    UFUNCTION(BlueprintCallable, Category = Inventory)
    void AddPickable(class APickable* Picked);

    void AddWeapon(class ABaseWeapon* weapon);

    bool CanAddInventory(APickable* PickableToAdd);

    void ThrowPickable(APickable* PickableThrow);

    /** [server] spawns default inventory */
    void SpawnDefaultInventory();

    //Poids maximum de l'inventory
    float MaxInventoryWeight;

    float CurrentInventoryWeight;


    //utilisé pour équiper une arme depuis l'inventaire
    UFUNCTION(BlueprintCallable, Category = Inventory)
        void EquipWeapon( EWeaponSlot  WeaponSlot);


    /** equip weapon */
    UFUNCTION(reliable, server, WithValidation)
        void     ServerEquipWeapon( EWeaponSlot weaponslot);


    void UnequipWeapon(ABaseWeapon* WeaponToUnequip);

    UFUNCTION(BlueprintCallable, Category = Inventory)
    void EquipPrimary();


    UFUNCTION(BlueprintCallable, Category = Inventory)
        void EquipSecondary();

    UFUNCTION(BlueprintCallable, Category = Inventory)
    void EquipSideGun();

    UFUNCTION(BlueprintCallable, Category = Inventory)
        void EquipThrowable();

    UFUNCTION(BlueprintCallable, Category = Inventory)
        void OnNextWeapon();

    UFUNCTION(BlueprintCallable, Category = Inventory)
        void OnPreviousWeapon();


    /** current weapon rep handler */
    UFUNCTION()
        void OnRep_CurrentWeapon(class ABaseWeapon* LastWeapon);

    ///////////////////////////////////////////
    //input
    void MoveForward(float Val);

    void MoveRight(float val);

    /* Frame rate independent turn */
    void TurnAtRate(float Val);

    /* Frame rate independent lookup */
    void LookUpAtRate(float Val);

    /** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */
    float BaseTurnRate;

    /** Base lookup rate, in deg/sec. Other scaling may affect final lookup rate. */
    float BaseLookUpRate;


    void Jump()override;

    void Vault();

    /** get camera view type */
    UFUNCTION(BlueprintCallable, Category = Mesh)
        virtual bool IsFirstPerson() const;

public:
    /** get weapon attach point */
    FName GetWeaponAttachPoint() const;

    //Socket au niveau de la main
    UPROPERTY(EditAnywhere, Category = WeaponSocket)
        FName WeaponAttachPoint;

    //Socket au niveau du dos pour primary
    UPROPERTY(EditAnywhere, Category = WeaponSocket)
        FName PrimaryAttachPoint;

    //Socket au niveau du dos pour secondary
    UPROPERTY(EditAnywhere, Category = WeaponSocket)
        FName SecondaryAttachPoint;

    //Socket au niveau du dos pour secondary
    UPROPERTY(EditAnywhere, Category = WeaponSocket)
        FName SideGunAttachPoint;


    USkeletalMeshComponent* GetPawnMesh() const;

    /*
    * Get either first or third person mesh.
    *
    * @param    WantFirstPerson        If true returns the first peron mesh, else returns the third
    */
    USkeletalMeshComponent* GetSpecifcPawnMesh(bool WantFirstPerson) const;



    /** check if pawn is still alive */
    bool IsAlive() const;


    //Health actuelle du player
    UPROPERTY(BluePrintReadWrite, Replicated)
        float Health;

    //healthmax
    float HealthMax;

    UPROPERTY(BluePrintReadWrite)
        bool Prone;



private:

    /** pawn mesh: 1st person view */
    UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
        USkeletalMeshComponent* Mesh1P;




    /** Take damage, handle death */
    virtual float TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser) override;


    /**
    * Kills pawn.  Server/authority only.
    * @param KillingDamage - Damage amount of the killing blow
    * @param DamageEvent - Damage event of the killing blow
    * @param Killer - Who killed this pawn
    * @param DamageCauser - the Actor that directly caused the damage (i.e. the Projectile that exploded, the Weapon that fired, etc)
    * @returns true if allowed
    */
    virtual bool Die(float KillingDamage, struct FDamageEvent const& DamageEvent, class AController* Killer, class AActor* DamageCauser);


public:
    //////////////////////////////////////////////////////////////////////////
    // Animations

    /** play anim montage */
    virtual float PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate = 1.f, FName StartSectionName = NAME_None) override;

    /** stop playing montage */
    virtual void StopAnimMontage(class UAnimMontage* AnimMontage) override;

    /** stop playing all montages */
    void StopAllAnimMontages();

    //UAnimMontage VaultMontage;

    ////////////////////////////////////////////////////
    //fIRE & weapon managements

    void Fire();

    void OnStopFire();

    bool CanFire();

    UFUNCTION(reliable, server, WithValidation)
        void ServerFire();

    bool IsReloading;

    void ChangeFireMode();

    bool TriggerPulled;

    ////////////////////////////////////
    //Ammo

    int8 GetAmmo(EAmmoKind Ammo );

    void Reload();

    UFUNCTION(reliable, server, WithValidation)
    void ServerReload();



    ///////////////////////////////////////////////////
    //Interaction


    AActor InteractActor;

};


Problem solved.

It seems it was in the header the last line I forgot a *

Thanx for the help !