#include "ShellEjection_9mm.h"
#include "Components/SphereComponent.h"
// Sets default values
AShellEjection_9mm::AShellEjection_9mm()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Shell = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Shell"));
Shell->SetupAttachment(RootComponent);
Sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere"));
Sphere->SetupAttachment(Shell);
}
// Called when the game starts or when spawned
void AShellEjection_9mm::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AShellEjection_9mm::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
the cpp of the actor I’m trying to spawn ^
here’s a screenshot of the bp actor
(it’s just a sphere for now since I’m just testing it)
Without knowing the scene: my guess is that it could be getting stuck inside a collision when spawning. With AlwaysSpawn it should at least stay in the outliner unless its set to destroy someplace else. No?
well here’s a video of my scene, I’d say its pretty open. I didn’t realize collisions could be a problem though so I tried reducing the collision size on the actor but it didn’t seem to do anything either
Is that when something falls of the map and it destroys the actor? I tried jumping off the map and it doesn’t do anything I just infinitely fall down if that’s what you mean
alright so i just decided to add a print underneath in the spawnactor class and the print doesn’t pop up. So the issue is probably related to the actor class, I just don’t know what could be causing the issue. Any ideas?
AShellEjection_9mm::AShellEjection_9mm()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Shell = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Shell"));
Shell->SetupAttachment(RootComponent);
Sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere"));
Sphere->SetupAttachment(Shell);
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, "Debug");
}
just let me know if you need more screenshots of anything else
edit: I also just tried putting a print at the beginning of the function and nothing happens either
AShellEjection_9mm::AShellEjection_9mm()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, "Debug");
Shell = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Shell"));
Shell->SetupAttachment(RootComponent);
Sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere"));
Sphere->SetupAttachment(Shell);
}
If it gets destroyed instantly this should tell us. If it fails to spawn the Output Log will say. The only other way I can think to help is @Lime_Energy shares an empty project with the character, weapon and shell classes.