[UE4.27] LineTraceSingleByChannel not working in packaged game (works in editor)
Description
I am using Unreal Engine 4.27 (official source version from GitHub) to develop a multiplayer game with a dedicated server.
In my game world, I spawn a base that generates AI allies through a widget. The base is a Destructible Mesh created with APEX.
I am using LineTraceSingleByChannel
to detect collisions, and the issue I am facing is:
- In the editor (PIE), the collision detection works as expected.
- In the packaged game (Development build), the collision is not detected.
Code Example
Here is the relevant code for the ray trace:
FHitResult HitResult;
FCollisionQueryParams CollisionParams;
//CollisionParams.bTraceComplex = true;
// Perform the ray trace
bool bHit = GetWorld()->LineTraceSingleByChannel(
HitResult,
StartLocation,
EndLocation,
ECC_Visibility,
CollisionParams
);
UE_LOG(LogLevel, Warning, TEXT("[Server] - Ray Trace Hit Event bHit is: %s"), bHit ? TEXT("True") : TEXT("False"));```
## What I Have Tried
Ensured that the collision settings on the Destructible Mesh are correct.
Tested with bTraceComplex = true, but the issue persists.
Verified that the Destructible Mesh exists in the world when the trace runs.