Add a Sky

In short

Every park’s sky is Unity’s built-in Skybox/Procedural shader, retuned per park by SkyBuilder from the park’s sky preset. A new sky = a SkyPreset value, a case in SkyBuilder.Tune, and park.sky = SkyPreset.X in DefaultContent. Today’s presets: ClearDay (default), Overcast, Night, Space.

Steps

  1. Enum value. Add it at the end of enum SkyPreset in Assets/_Project/Scripts/Data/BallparkDefinition.cs.
  2. Tune it. Add a case in SkyBuilder.Tune (Assets/_Project/Scripts/Ballparks/SkyBuilder.cs). Set takes 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;
  3. Use it on a park in Assets/_Project/Scripts/Data/DefaultContent.cs:
    windy.sky = SkyPreset.Overcast;
  4. Decide the extras that switch on the preset:
    • BallparkBuilder.BuildSky: stars only for Night and Space; the Earth only for Space.
    • StadiumAmbience.Build: clouds and birds only for ClearDay and Overcast. 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’s batterModifiers (the timing penalty) are not set by the sky preset.
  • If the procedural shader is missing (stripped from a build), SkyBuilder falls back to a flat background colour. Editor/SkyShaderInclude.cs adds Skybox/Procedural to Always Included Shaders on Editor load to prevent that.
  • Append enum values; the preset is stored as a number in exported park assets.