Appearance
Developer notes — kids.kapish.environment
unity
Where it sits
kids.kapish.environment depends on kids.kapish.splines.paths (PathManager) and kids.kapish.splines.vista (PathFlattenNode + the VISTA_UNITY_SPLINE define), and references Pinwheel Vista and the core render-pipeline assembly directly. It's the top of the path/terrain stack: paths and vista don't know about it; it knows about both.
The whole assembly is gated on VISTA_UNITY_SPLINE && !VISTA_EXCLUDE_PRO — same constraint as Carrot.Splines.Vista — because the bake fundamentally needs VistaManager and PathFlattenNode.ApplyDrop. In a project without Vista there's no EnvironmentManager (yet); the reference-holding façade will split out behind its own flags when the non-Vista stack pieces land.
The bake state machine
BakeAll() is a three-phase, editor-update-driven sequence (it can't block — Vista bakes are async):
- Flatten —
PathFlattenNode.ApplyDrop = false, thenVistaManager.ForceGenerate()on every resolved manager. - Drop (entered once the flatten pass reports no active task) —
PathManager.RebuildAll()on every resolved path manager, thenApplyDrop = trueandForceGenerate()again. - Idle — restores
ApplyDrop = trueand detaches theEditorApplication.updatetick.
Guards: a SettleSeconds grace before trusting VistaManager.HasActiveTask() (so a just-kicked bake isn't mistaken for "already done"), and a TimeoutSeconds wall-clock so a stuck bake can't loop forever. ApplyDrop is always restored to true on finish/fail so the global gate never leaks the flatten state.
History
This was PathBakeManager in kids.kapish.splines.vista. It moved here (GUID preserved, so existing scene references rebind) and generalised: the mid-bake mesh rebuild now delegates to PathManager.RebuildAll() instead of iterating a local mesh list, and the component grew the wider environment-stack references.
Extending
Current is the seam for gameplay. Keep third-party types (ocean/sky/weather assets) out of the public surface — marshal them into Carrot interfaces behind install-detection defines so a consumer that doesn't have a given asset still compiles.
Usage Guide
Set up the stack
- Create an empty
EnvironmentGameObject at the root of your scene's environment hierarchy. - Add an EnvironmentManager (
Add Component → Carrot → Environment → Environment Manager). - Parent your terrain (Vista), low-poly dressing, ocean, sky, post-process volume and
PathManager(s) under it. - Wire the references:
- Terrain Managers / Path Managers — leave empty to auto-use every one in the scene, or list specific ones to scope the bake.
- Low Poly Environment / Ocean / Sky / Post Process — organisational references (not used by the bake yet).
Bake
Press Bake All (inspector button, or the component's context menu). It runs three passes:
- Flatten — Vista regenerates with the path drop gated off (clean bed).
- Paths — every
PathManager.RebuildAll()rebuilds its mesh/object strips onto the flat bed. - Drop — Vista regenerates with the drop applied; the terrain sinks under the paths for clearance.
The button is disabled while a bake is in flight, and the bake aborts safely if a Vista pass never finishes (600 s wall-clock guard).
Rebuilding the path geometry on its own (no terrain passes) is a
PathManagerjob — use its Rebuild All. The EnvironmentManager is for the full terrain-and-paths bake.
Gameplay access (later)
EnvironmentManager.Current returns the active environment. As ocean/sky/weather systems are installed, they'll be marshalled into stable interfaces behind preprocessor flags so gameplay can read time-of-day / weather without referencing the third-party assets directly.