Developer Notes

Setting the value to 0 was undefined behavior because the default-value was not initialized and therefore is not a regression. If you want to have it drawing indefinitely than setting it to positive infinity would still be an option that makes more sense than Zero.

Description

Setting the lifetime for one of the visual debug helpers (a sphere was used in the repro, but the results should be similar for any of the debug helpers) to a value of 0 or less should make the debug helper remain visible on the screen indefinitely. However, the debug helper disappears after 1 second. This appears to be the result of CL 4059141, where the DefaultLifeTime for ULineBatchComponent was initialized to 1.0 (it had previously been uninitialized). This should probably be initialized to 0.0 instead.

REGRESSION:
Yes. In 4.19 a lifetime value of 0 or less would allow the debug helper to be drawn indefinitely.

Steps to Reproduce
  1. Create a new Basic Code project.
  2. Add a new Actor code class to the project.
  3. In the new Actor's BeginPlay() function, add the following code: DrawDebugSphere(GetWorld(), this->GetActorLocation(), 150.f, 16, FColor::Red, true, -1.f, 0, 0.25f);
  4. Add #include "DrawDebugHelpers.h" to the top of the Actor source file.
  5. Build the project in Visual Studio.
  6. Open the project in the Editor.
  7. Place an instance of the Actor in the level.
  8. Start PIE.

RESULT:
A debug sphere will be drawn around the starting location of the camera in the level, and will disappear after 1 second.

EXPECTED:
A debug sphere will be drawn around the starting location of the camera in the level, and will remain visible indefinitely since the lifetime is set to -1.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-63914 in the post.

2
Login to Vote

Won't Fix
ComponentUE - Graphics Features
Affects Versions4.20.24.21
Target Fix4.21
CreatedSep 10, 2018
ResolvedSep 17, 2018
UpdatedSep 26, 2018