I have a EditorCallable UFUNCTION inside my character class.
I added this kind of script inside it in order to track line:
if (GEngine->GetWorld())
{
FVector Loc;
FRotator Rot;
FHitResult Hit;
GEngine->GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(Loc,Rot);
FVector Start = Loc;
FVector End = Start +(Rot.Vector()*100);
FCollisionQueryParams TraceParameters;
bool bHit = GEngine->GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECC_Visibility, TraceParameters);
if(bHit)
{
DrawDebugLine(GEngine->GetWorld(), Start, End,FColor::Red,false,2.0f);
}
}
in header:
UFUNCTION(CallInEditor, Category = "Transform")...
When I add a BP to world then click the produced editor button my engine crashes. However, when I do something like that in BP (LineTraceByChannel in construction node) I see track lines. What is wrong with “UFUNCTION” ?