Lighting & Nav Baker
Overview
A "World Builder" utility that orchestrates the heavy blocking processes of level design. Instead of manually clicking "Bake" on multiple tabs, this skill ensures the environment is fully prepped for gameplay.
When to Use
- Use after modifying level geometry.
- Use before making a production build.
- Use to enforce lighting quality settings (Draft vs Production).
- Use to rebuild NavMesh Surfaces after moving obstacles.
Architecture
┌─────────────────────────────────────────────────────────────┐
│ WORLD BAKER │
├─────────────────────────────────────────────────────────────┤
│ │
│ BAKE MANAGER (EditorWindow) │
│ ┌───────────────────────────┐ │
│ │ [ Button: BAKE WORLD ] │ │
│ └─────────────┬─────────────┘ │
│ │ │
│ ▼ │
│ 1. CLEAR DATA │
│ - Lightmapping.Clear() │
│ - NavMesh.RemoveAllNavMeshData() │
│ │ │
│ ▼ │
│ 2. CONFIGURE │
│ - Set LightSettings (Samples: 1024) │
│ │ │
│ ▼ │
│ 3. EXECUTE │
│ - Lightmapping.BakeAsync() │
│ - NavMeshSurface.BuildNavMesh() │
│ │
└─────────────────────────────────────────────────────────────┘
Best Practices
- ✅ Use
NavMeshSurface(AI Navigation package) instead of the legacy static baker for runtime flexibility. - ✅ Always provide a "Clear" option to remove stale data.
- ✅ Run Lighting Bake asynchronously to avoid freezing the Editor UI completely.
- ❌ NEVER bake lighting in Play Mode.
- ❌ NEVER forget to mark objects as "Static" before baking.
Few-Shot Examples
Example 1: NavMesh Bake
User: "Rebuild NavMesh."
Agent:
public void BakeNavMesh()
{
var surfaces = Object.FindObjectsOfType<NavMeshSurface>();
foreach(var surface in surfaces) surface.BuildNavMesh();
}
TDD Contract
⚠️ Legacy Skill — Refactor Pending
Este skill NO tiene tests automatizados aún. El siguiente boilerplate es un punto de partida.
// Escribe estos tests ANTES de implementar:
// Test 1: should [expected behavior] when [condition]
[Test]
public void LightingNavBaker_Should{ExpectedBehavior}_When{Condition}()
{{
// Arrange
// TODO: Setup test fixtures
// Act
// TODO: Execute system under test
// Assert
Assert.Fail("Not implemented — write test first");
}}
// Test 2: should handle [edge case]
[Test]
public void LightingNavBaker_ShouldHandle{EdgeCase}()
{{
// Arrange
// TODO: Setup edge case scenario
// Act
// TODO: Execute
// Assert
Assert.Fail("Not implemented");
}}
// Test 3: should throw when [invalid input]
[Test]
public void LightingNavBaker_ShouldThrow_When{InvalidInput}()
{{
// Arrange
var invalidInput = default;
// Act & Assert
Assert.Throws<Exception>(() => {{ /* execute */ }});
}}
Pasos para completar el TDD:
- Descomenta los tests above
- Implementa la funcionalidad mínima para que compile
- Ejecuta los tests — deben fallar (RED)
- Implementa la funcionalidad real
- Verifica que los tests pasen (GREEN)
- Refactorea manteniendo los tests verdes
Nota: Este skill fue marcado como tdd_first: false durante la auditoría v2.0.1. La sección TDD fue agregada automáticamente pero requiere customización manual para reflejar el comportamiento real del skill.
Related Skills
@environment-hazard-system- NavMesh depends on environment@custom-editor-scripting- UI for the tool