I’d like to decrease the sensing interval of UPawnSensingComponent, so I used the following line of code.
PawnSensingComp->SetSensingInterval(0.1f);
However, the editor crashed during compiling, and the project cannot be re-opened until I commented out the line of code and regenerated the visual studio project files manually.
The following is part of crash report.
Access violation - code c0000005 (first/second chance not available)
UE4Editor_Engine!AActor::GetWorldTimerManager() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\engine\private\actor.cpp:289]
UE4Editor_AIModule!UPawnSensingComponent::SetSensingInterval() [d:\build\++ue4+release-4.12+compile\sync\engine\source\runtime\aimodule\private\perception\pawnsensingcomponent.cpp:99]
Is there any way which can successfully decrease the sensing interval?
Thanks!
EDIT: attach the full code
#include "RunForLife.h"
#include "NPCCharacter.h"
#include "Perception/PawnSensingComponent.h"
ANPCCharacter::ANPCCharacter()
{
// Creates and sets sensing component
PawnSensingComp = CreateDefaultSubobject<UPawnSensingComponent>(TEXT("PawnSensingComp"));
if (PawnSensingComp)
{
PawnSensingComp->SetPeripheralVisionAngle(120.0f);
PawnSensingComp->SightRadius = 2000.0f;
PawnSensingComp->HearingThreshold = 600.0f;
PawnSensingComp->LOSHearingThreshold = 1200.0f;
PawnSensingComp->SetSensingInterval(0.1f);
}
}