To determine when lights are being dynamically loaded in Unreal Engine, you need to analyze your project’s lighting system to identify whether lights are being created, activated, or loaded at runtime. Here’s how you can find out:
1. Check for Dynamic Light Setup in Blueprints or C++
Blueprint Search:
- Use Find in Blueprints:
- Go to the Content Browser.
- Open Find in Blueprints.
- Search for terms like:
Create Light
Add Component
Set Light Intensity
Set Visibility
- This will reveal where lights are being dynamically added or manipulated at runtime.
C++ Search:
- Search your codebase for
NewObject<UPointLightComponent>
or similar calls. - Look for
SetVisibility
,SetIntensity
, or other light manipulation functions.
2. Use the Stat LightRendering
Command
Run your game and enable light profiling:
- Press
~
(tilde) to open the console. - Enter:
stat lightrendering
- This will display information about dynamically rendered lights:
- Dynamic Lights Count: Shows how many lights are being rendered dynamically.
- Light Types: Differentiates between stationary and movable lights.
3. Log Dynamic Light Events
Add logging to your Blueprints or C++ code to track when lights are being loaded or activated.
Blueprint Logging:
- Add a Print String node in the graph where lights are created or manipulated dynamically.
C++ Logging:
- Insert a
UE_LOG
statement where lights are created or activated:UE_LOG(LogTemp, Warning, TEXT("Dynamic light created: %s"), *LightComponent->GetName());
4. Inspect Dynamic Lights in the Scene
Editor Viewports:
- Use Light Complexity View Mode:
- In the viewport, click on the dropdown next to the Lit button.
- Select Light Complexity.
- Dynamic lights will appear in red or orange, indicating their higher cost compared to static lights.
- Stationary Light Overlap:
- Shows overlapping lights, which might indicate dynamic setup issues.
5. Use Profiling Tools
Unreal Insights:
- Profile lighting performance to identify when and where lights are dynamically created or rendered.
GPU Profiling (Stat GPU
):
- Enter
stat gpu
in the console. - Look for high-cost lighting operations, which often correspond to dynamic lighting.
6. Debug Lighting Initialization
Event Tick/Initialization Check:
- Track light components in your actors or Level Blueprint to see if they’re being modified during runtime.
Actor/Component Lifecycle:
- Check actor lifecycle functions (e.g.,
BeginPlay
,Tick
) in Blueprints or C++ to identify dynamic light setups.
Summary
To identify dynamically loaded lights:
- Search Blueprints/C++ for light creation or modification.
- Use
stat lightrendering
andstat gpu
to profile dynamic lights at runtime. - Visualize lighting complexity using Light Complexity View Mode.
- Add logging to track light initialization or activation.
Would you like guidance on interpreting profiling results or setting up specific debug tools?