After Creating Post Process through C++ - "Volume Actor has a collision component with 0 radius - please delete"

How do I either give the PostProcess a Collision Radius, or disable the collision entirely (Through Code).

The post process is being created in editor, then I am trying to build the level.

The collision does not matter to me as I am making the Volume Unbound.

PostProcessVolume =
GWorld->SpawnActor(APostProcessVolume::StaticClass(),
FVector::ZeroVector,
FRotator::ZeroRotator);

I have run into the same error by trying to create a blueprint of a custom class inheriting AVolume, which PostProcessVolume also inherits from.

The post here c++ - How to create a blueprint that extends the volume(like physic volume) in UE5? - Stack Overflow suggests that you cannot just create a new volume, but it needs to be instantiated by its specific factory (UFactory | Unreal Engine 5.2 Documentation).

In the FPlacementModeModule.cpp of Unreal you can find:

UActorFactory* PPFactory = GEditor
->FindActorFactoryByClassForActorClass(UActorFactoryBoxVolume::StaticClass(), APostProcessVolume::StaticClass());

After that you might be able to instantiate your PostProcessVolume with that factory, I haven’t tried this myself though.

Can confirm it works without crashing the editor

void ACustomVolume::BeginPlay() {
	Super::BeginPlay();

	FActorSpawnParameters p;	
	UActorFactory* PPFactory = GEditor->FindActorFactoryByClassForActorClass(UActorFactoryBoxVolume::StaticClass(), APostProcessVolume::StaticClass());
	PostProcessVolume = (APostProcessVolume*) PPFactory->CreateActor(APostProcessVolume::StaticClass(), GetLevel(), FTransform::Identity, p);		
	PostProcessVolume->SetActorHiddenInGame(false);
}

Spawns a post process volume into the editor on play.
It has a name and transform but the brush component for some reason is not visible in the viewport. Will have to feed it a post process material to see if it changes the scene visually.

Though I did find another post regarding the same subject and the staff replied that stuff like post processing volumes should be made in the editor with the normal tools.

1 Like