Add a Sky
In short
Every park’s sky is Unity’s built-in
Skybox/Proceduralshader, retuned per park bySkyBuilderfrom the park’sskypreset. A new sky = aSkyPresetvalue, a case inSkyBuilder.Tune, andpark.sky = SkyPreset.XinDefaultContent. Today’s presets:ClearDay(default),Overcast,Night,Space.
Steps
- Enum value. Add it at the end of
enum SkyPresetinAssets/_Project/Scripts/Data/BallparkDefinition.cs. - Tune it. Add a case in
SkyBuilder.Tune(Assets/_Project/Scripts/Ballparks/SkyBuilder.cs).Settakes the sky tint, ground colour, exposure, atmosphere thickness, sun size and sun size convergence:case SkyPreset.Overcast: Set(new Color(0.62f, 0.64f, 0.68f), new Color(0.42f, 0.42f, 0.44f), 0.95f, 0.55f, 0.015f, 6f); break; - Use it on a park in
Assets/_Project/Scripts/Data/DefaultContent.cs:windy.sky = SkyPreset.Overcast; - Decide the extras that switch on the preset:
BallparkBuilder.BuildSky: stars only forNightandSpace; the Earth only forSpace.StadiumAmbience.Build: clouds and birds only forClearDayandOvercast. Add your preset to whichever list fits.
How it works
SkyBuilder.Apply makes one skybox material once, retunes it for the park, sets it as RenderSettings.skybox,
links the sun light, and takes ambient light from the sky (AmbientMode.Skybox, intensity 0.7 when isNight, else 1).
So a darker sky also darkens characters and the field.
Check it works
Press Play and open the park: map select builds the centred park behind the carousel, and each card’s picture
(UI/ParkSnapshots) is a photo of the built park with its sky, taken once per session. The batting cage can switch
parks from its pause menu (PARK: button), and the match intro opens on the sky (Cutscenes). No self-test
covers the sky.
Gotchas
- Night gameplay is separate:
isNight(lamps, ambient) and the park’sbatterModifiers(the timing penalty) are not set by the sky preset. - If the procedural shader is missing (stripped from a build),
SkyBuilderfalls back to a flat background colour.Editor/SkyShaderInclude.csaddsSkybox/Proceduralto Always Included Shaders on Editor load to prevent that. - Append enum values; the preset is stored as a number in exported park assets.
Related
- Rendering: URP, lighting and post-processing
- Ballpark Building: everything built for a park
- Ballparks: which park uses which sky
- Add a Map