Skip to content

Optimization

This is an editor-only optimization that generates a static mesh in a specified folder to improve runtime performance.

If cables remain static and do not update when you modify the spline, you likely have a merged static mesh active. Remove it first to regain editability.

Why bake to a static mesh?

Procedurally generated cables have runtime costs. Baking them into a static mesh addresses several performance concerns:

  1. Reduced Overhead: Each procedural mesh component has its own runtime cost. A single static mesh is far more efficient.
  2. Faster Load Times: Generating complex cables for a large level can cause noticeable delays when the game starts.
  3. Streaming Compatibility: In world-partitioned levels, each time a cell loads, procedural cables must rebuild, potentially causing hitches during fast travel or exploration. A static mesh loads instantly.

To mitigate this, we can bake all cables into a static mesh.


Reference

FeatureDescriptionDetails / Notes
Create Static CablesBakes procedural cables into a static mesh, saves it, and reruns the construction script.Primary tool for performance optimization.
Remove ReferenceClears the reference to the merged static mesh from the actor and refreshes it.Use this if you duplicated an actor that already had a baked mesh, to break the reference.
Remove Static CablesPermanently deletes the baked static mesh asset from diskDestructive action – cannot be undone via Edit > Undo. Use with caution.
Path NameA configurable variable to set the default save folder for baked static meshes.Default location: /Game/Meshes/. Example: /Game/Meshes/Cables/.
Merged Cable MeshA private, read-only variable holding a reference to the generated static mesh.Allows inspection via double-click; note that the mesh may appear with an unusual rotation.

There is a known issue with the merged mesh system and the editor’s level save process.

If you baked a merged mesh and later decide to remove it using Remove Static Cables, an editor crash or closure before saving the level can cause a problem. Upon reopening the unsaved level, you may encounter an error stating the powerline actor contains an invalid reference. This occurs because:

  1. The physically baked static mesh asset was deleted from disk.
  2. The unsaved level still contains a powerline actor with a reference pointing to the now-deleted asset.
    Advice: Always save your level immediately after baking or removing a merged static mesh to prevent this reference corruption.
Last updated on