Cannot Change SphereCollision's Radius

I tried to changed SphereCollision’s Radius in several place:


InteractorComponent = CreateDefaultSubobject<UInteractorComponent>(TEXT("InteractorComponent"));
InteractorComponent->OnComponentBeginOverlap.AddDynamic(this, &APGCharacterBase::OnInteractorBeginOverlap);

The debug line do show the radius is 500.0f.
However, at in-game, the radius does not reflect to 500.0f. OnComponentBeginOverlap does not fire until I’m at radius 32.0f.

Though, I have found out to force the Component to recognize 500.0f as the collision radius, I have to do the OnComponentBeginOverlap in Blueprint. Is there anyway I can it without going through Blueprint?

Edit: I have moved the function binding into PostInitializeComponents and it still does not work. More so, after trying to figure out what’s going, the OnComponentBeginOverlap at the Blueprint side started failing.

to be honest your initial code looks correct

I tested it myself with a normal sphere component and it works as you would expect

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

#pragma once

#include "CoreMinimal.h"
#include "AnswerHubAnswersCharacter.h"
#include "CharacterWithSphere.generated.h"

class USphereComponent;

UCLASS(config = Game)
class ACharacterWithSphere : public AAnswerHubAnswersCharacter


	void BeginPlay() override; 
	void OnInteractorBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
		UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
		const FHitResult& SweepResult);

	USphereComponent* SphereComponent;


#include "CharacterWithSphere.h"
#include "Components/SphereComponent.h"

	SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("USphereComponent"));

void ACharacterWithSphere::BeginPlay()
	SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &ACharacterWithSphere::OnInteractorBeginOverlap);

void ACharacterWithSphere::OnInteractorBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, 
	int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
	UE_LOG(LogTemp, Warning, TEXT("So Overlappy!"));

The only thing i changed is move the registration to the overlap into the BeginPlay
had strange behavior in the past when I had that somewhere else.

So either your UInteractorComponent is doing something strange, or the radius is changed somewhere else.

I did try to move the function bindings into BeginPlay() but I remembered I was still seeing that problem and I didn’t set the radius anywhere except that place. Probably I have to rebuild the project tmr.

Another question is, putting the function bindings in PostInitializeComponents is still dangerous?

I’ll try it tmr, will comment here whether if it’s working or not.

if you look at the ActorLifecycle it should be fine, I personally still prefer BeginPlay(), since it’s exactly the same behavior for spawned and loaded actors

It seems the problem is solved by rebuilding, weird, but thanks for helping.