How unity-technologies/boatattack works
Project Type and Purpose
• This is a Unity3D demo project (“Boat Attack”) built as a vertical slice of a boat‑racing game.
• Its purpose is to showcase and test Universal Render Pipeline (URP) features, custom water/caustics shaders, addressables asset management, C# Jobs–based buoyancy, Cinemachine camera setups, and mobile optimization techniques.
File Structure Analysis
• Top‑level folders:
• Assets/ – all game content (Scenes, Scripts, Shaders, Materials, Models, Audio, Textures, Addressable assets, etc.)
• Packages/ – the local com.verasl.water-system package (custom Gerstner‑wave water system)
• ProjectSettings/ – Unity editor and build configurations
• Within Assets/:
• Scenes/ – all scene files (main_menu, demo_island, level_Island, Testing, benchmarks)
• Scripts/ – C# code organized by domain (Boat, Camera, Environment, GameSystem, UI, Effects, System, Utility)
• Shaders/ – Shader Graph and HLSL assets (URP Graphs, custom water & caustics passes)
• AddressableAssetsData/ – addressables configuration and group templates
• Materials, Textures, Models, Prefabs, Audio – traditional asset folders
• Packages/com.verasl.water-system/:
• Scripts/, Shaders/, Materials/, Meshes/, Textures/ – the modular water simulation package
• Build & config files:
• Packages/manifest.json – package dependencies
• ProjectSettings/ProjectVersion.txt – Unity version
• link.xml, .gitmodules, TestRunnerOptions.json, etc.
README Insights
• Core features listed: URP, addressables, C# Jobs buoyancy, Cinemachine, Shader Graph, ScriptableRenderPass, custom planar reflections.
• Scenes: main menu, demo island (quick launch), level_Island (gameplay), various test/benchmark scenes.
• Build instructions: build addressable assets, then build player via Unity.
a. Main Components
• Unity Editor / Engine (Runtime host)
• Scene Management
• Addressables Asset System
• Rendering Pipeline (URP core + Custom ScriptableRenderPass for WaterFX & Caustics)
• Water System Package (com.verasl.water-system)
• Physics & Buoyancy (C# Jobs system + NavMeshComponents for AI navigation)
• Gameplay Systems (RaceManager, AIController, InputControls)
• Camera Subsystem (Cinemachine controllers, ReplayCamera)
• UI Subsystem (Menus, Race HUD, Benchmark)
• Asset Groups (Models, Materials, Textures, Shaders, Audio)
• Build & Deployment (Addressables Builder, Player Build)
• External Dependencies (Git LFS, Unity Package Manager)
b. Relationships & Data Flows
• On project load, Unity Editor reads ProjectSettings → populates Scenes.
• Scene Manager loads main_menu → UI Subsystem handles user input → invokes Scene transitions.
• Addressables subsystem asynchronously loads runtime assets (models, textures, audio) from pre‑built bundles.
• Rendering Pipeline receives scene geometry, invokes URP passes → applies custom WaterFX & Caustics passes from Water System package.
• Physics & C# Jobs buoyancy update boat positions → NavMeshComponents update AI paths.
• Gameplay Systems process input (keyboard/touch via InputControls), update RaceManager → notify UI and Camera subsystems.
• Camera Subsystem (Cinemachine + custom scripts) follows boats / replay.
• Benchmark/Testing scenes invoke Benchmark scripts → gather MiniProfiler and PerformanceStats.
c. Architectural Patterns & Principles
• Modular packaging: local package for water system (clean separation of concerns)
• SRP (Scriptable Render Pipeline) callbacks for custom render passes
• Addressables for decoupled asset loading and grouping
• C# Jobs + Burst for data‑oriented performance in buoyancy calculations
• MVC‑style separation in UI: Views (prefabs), Controllers (MainMenuHelper, RaceUI), Models (BenchmarkConfigData)
d. Key Technologies & Frameworks
• Unity Universal Render Pipeline (URP)
• Addressables Asset Management
• C# Jobs & Burst Compiler
• Cinemachine
• Shader Graph & HLSL
• NavMeshComponents (AI pathfinding)
• ScriptableRenderPass (custom URP features)