Claude & Unity Fruit Catcher (part 3): add lighting, post-processing, particles, and sound to make catches feel good

Translated from the original Traditional Chinese version.

Summary

With the rules done, the Fruit Catcher still looks like flat blocks, and catching fruit only changes the score. Unity lights, Volume post-processing, the Particle System, and Audio Source change how the game looks and sounds, and you can adjust most of them by editing values in the Inspector. This article is stage 5 of the Fruit Catcher. It uses four prompts to have Claude add the effects one at a time. For each one, it explains which settings Claude changed and where to check them in the Editor.

Table of contents

After Claude & Unity Fruit Catcher (part 2), the game can be played from start to Game Over, but when you catch fruit, only the score in the upper left changes. Players notice the feedback at the moment of a catch: juice spraying out, the screen shaking, a sound. Unity produces these with lights, Volume post-processing, the Particle System, and Audio Source, and you can adjust most of them in the Inspector.

This article is stage 5 of the Fruit Catcher. It has four prompts. After each one, press Play to check before you give the next. This is the game before any of them:

The Game view at stage 4: the sky is a saturated blue, the grass is an even green, and the two trees and the basket have dark shadows

This article continues with the project and session from the previous two articles, and Claude again follows CLAUDE.md (the project rules file from part 1) to create a branch and open a pull request. I tested on Windows 11 and Unity 7000.0.0a23 (Alpha). The project uses the Universal 3D template, which means the URP render pipeline.

Adjust the light and the fog

The template’s Directional Light is a parallel light that models the sun. The lit sides and the shadows of the objects in the scene come from it. In the session with Claude, type:

1Change the Directional Light to a warm color and turn on soft shadows, so the falling fruit casts shadows on the ground. Then add a weaker cool-colored fill light and turn on a light fog, so the background in the distance has some depth. When you finish, take a screenshot of the Game view and show it to me.

The template’s Directional Light already uses soft shadows, and the fruit already had shadows in stage 4. So Claude only changed the light’s color, its intensity, and how dark the shadows are. It also added a cool-colored fill light called Fill Light, which shines from the opposite direction so the side facing away from the sun isn’t too dark. The sky and the grass in the distance are lightened by the fog, and the shadows are lighter with a little warmth:

The Game view after the light and fog changes: the sky is a grayish light blue, the grass near the horizon is washed out by the fog, and it gets greener closer to the camera

Select Directional Light in the Hierarchy. In the Inspector, “Color” is the warm color Claude set, “Shadow Type” is “Soft Shadows”, and “Strength” is how dark the shadows are:

The Inspector for Directional Light: Color is light orange, Intensity is 2, Shadow Type is Soft Shadows, and Strength is 0.75

The fog isn’t on any object. Open the Lighting window from “Window” > “Rendering” > “Lighting”, switch to the “Environment” tab, and adjust “Fog” under “Other Settings”. “Density” is how thick the fog is. If you raise it a little too far, the whole screen turns grayish white:

The Environment tab of the Lighting window: under Other Settings, Fog is checked, Mode is Exponential Squared, and Density is 0.015

Add Volume post-processing

Post-processing adjusts the color and glow of the whole image after the frame is drawn. URP manages post-processing with the Volume component. The template’s scene already contains a Global Volume object. It has a Volume component, which holds the post-processing effects. Its “Mode” is “Global”, so the effects apply to the whole screen. Keep typing:

1Add Bloom, Tonemapping, Color Adjustments, and Vignette to the Global Volume, so the colors are more vivid and the sun and flashes have a glow. Use conservative values for now. Show me a screenshot and then we'll adjust.

Each of the four effects changes one aspect of the image:

Effect What changes on screen
Bloom Bright areas spread outward into a glow
Tonemapping Pulls overly bright colors back so the image isn’t overexposed
Color Adjustments Raises saturation and contrast so the colors are more vivid
Vignette Darkens the four corners so the eye stays in the middle

The template’s Volume profile already has Bloom, Tonemapping, and Vignette. Claude changed their values and added Color Adjustments. The profile was originally in Assets/Settings, and CLAUDE.md says the settings in Assets/Settings stay as they are, so Claude copied it to a new FruitCatcherVolumeProfile, edited the copy, and pointed Global Volume at the new profile. Select Global Volume in the Hierarchy, and the Inspector lists each effect. Each effect has a checkbox next to its name, and so does each value inside it. Only checked items apply. In this profile Motion Blur is left unchecked, so it has no effect:

The Inspector for Global Volume: Profile is FruitCatcherVolumeProfile, followed by Tonemapping, Bloom, Motion Blur (unchecked), Vignette, and Color Adjustments

After this stage, the green of the grass is more vivid than before. The Vignette Intensity is only 0.22, so the corners darken only slightly:

The Game view after post-processing: the grass is a more vivid green and the four corners are slightly darker

You can’t see Bloom’s glow in this picture. The background of the Fruit Catcher is a flat sky-blue surface, the camera can’t see the sun, and neither the sky nor the grass is bright enough. Bloom only makes areas brighter than the “Threshold” spread out. To see the glow, lower the Threshold in the Inspector, or put a glowing object in the scene.

Use particles for catch feedback

The juice that sprays out when you catch fruit is made with the Particle System. A particle system emits many small pieces in a short time, and each one fades out according to its speed, color, and lifetime. Keep typing:

1Make a juice splash particle effect and save it as a prefab. When the basket catches fruit, play it once at the basket's position, in the same color as the fruit. When it catches a bomb, play sparks and smoke particles instead, and shake the camera slightly.

Claude created two prefabs, JuiceSplash for the juice and BombBlast for the bomb, both in Assets/Prefabs. When BasketController catches fruit, it plays JuiceSplash just above the basket’s position and changes its color to the fruit’s color. When it catches a bomb, it plays BombBlast and calls CameraShake, which is on Main Camera, to shake the camera for 0.25 seconds. The prompt only asked for the juice to be saved as a prefab, and Claude also saved the bomb’s smoke and sparks as one. To make sure the sparks and smoke are always saved as a prefab, and to choose the folder, add one sentence to the prompt:

The Assets/Prefabs folder in the Project window: besides Apple, Banana, and Bomb there are now BombBlast and JuiceSplash, and an Audio folder in the Assets tree on the left

Click JuiceSplash in the Project window, and the Inspector shows the Particle System settings. “Duration” is how many seconds the burst lasts. “Start Lifetime”, “Start Speed”, and “Start Size” are each particle’s lifetime, speed, and size. Each is a range, and every particle picks a random value in it. “Start Color” is yellow, and the code replaces it with the fruit’s color when it plays:

The Particle System on the JuiceSplash prefab: Duration is 0.5, Start Lifetime is 0.35 to 0.7, Start Speed is 3 to 6, Start Size is 0.35 to 0.6, and Gravity Modifier is 1.2

When you catch an apple, a burst of red juice sprays above the basket:

The moment an apple is caught: a burst of small red particles above the basket

When you catch a bomb, gray smoke and orange-yellow sparks appear above the basket, and the lives in the upper right drop by 1:

The moment a bomb is caught: a cloud of dark gray smoke with orange-yellow sparks around it above the basket, and Lives: 2 in the upper right

The particles last only a fraction of a second. I slowed the game to 0.05 times its normal speed for these two screenshots, so the effects stay on screen about 20 times longer than they would in play. At normal speed the effect is a quick flash. If it looks too small or too fast, open the prefab and raise Start Size or Start Lifetime.

Add sound effects

Sound effects play through an Audio Source component. Keep typing:

1Add sound effects to the Fruit Catcher: one for catching fruit, one for catching a bomb, and one for Game Over. Put the sound files in Assets/Audio, play them with an Audio Source, and make the volume adjustable in the Inspector.

The prompt doesn’t say where the sound files come from, and if you download sounds from the internet, you have to check the license yourself. This time Claude wrote and ran a Python script that synthesizes three .wav files, so Python was installed on my machine. The fruit catch is two short high notes, the bomb is a low thud, and Game Over is three falling notes. It needs no outside assets. To control the source, add one sentence to the prompt: “Synthesize the sound files in code and don’t download outside assets.”

Claude added a SoundEffects object to the Hierarchy, with an Audio Source and a SoundEffects script on it. The Audio Source’s “Volume” is the overall volume, and the three volume sliders on SoundEffects adjust the three sounds separately.

The Inspector for SoundEffects: the Audio Source has Volume 0.8 and Play On Awake unchecked, and the Sound Effects script has Catch Clip, Bomb Clip, Game Over Clip, and three volume sliders

“Play On Awake” is unchecked, which means the Audio Source doesn’t play by itself when the game starts. It plays only when the code calls it.

Check your project against the example

After all four prompts, compared with stage 4 the sky is paler, there is fog at the horizon, the grass is more vivid, and the shadows are lighter with a little warmth:

The Game view at the end of stage 5: a pale blue sky, fog near the horizon, bright green grass, and a banana falling in the upper right

Stage 5 of the example project has this tag:

Tag What it contains
stage-5-polish Lights and fog, post-processing, juice and explosion particles, camera shake, and sound effects

On the Fruit Catcher example project on GitHub, clone or download the repository and run git checkout stage-5-polish to see every prefab and sound file. The main branch is this stage’s finished version too. The README also lists the original text of the four prompts, the files they add, and what to check in the Editor.

Test notes

Item Details
System Windows 11, physical machine
Editor Unity 7000.0.0a23 (Alpha), URP 17.7
Template Universal 3D (com.unity.template.urp-blank)
Example tedliou/claude-unity-fruit-catcher

I gave Claude the four prompts in order, and after each one I pressed Play and checked that the Console had no errors:

Part How I tested Result
Light and fog Compared the Play view The sky and the grass in the distance were paler, and the shadows were lighter with some warmth
Post-processing Compared the Play view The grass was more vivid. Nothing on screen was bright enough to show Bloom’s glow
Particles Slowed to 0.05 times and caught one apple and one bomb The apple sprayed red juice, the bomb gave off smoke and sparks, and the camera shook and then returned to its position
Sound Checked on every frame whether the Audio Source had started playing It started playing within 0.04 seconds after the apple and the bomb were caught, and the Game Over sound played after the third bomb

I also asked Claude to push the same ideas further in a different project, with golden apples, combos, and levels. It used the same lights, post-processing, and particles, with larger values and more effects. That project generates its scene in code, so it isn’t a good teaching example. Here is only its screenshot:

A version made in a different project: the basket glows gold after catching fruit, “+100!” pops up above it, and “COMBO x2!” is in the center of the screen

Summary

Lights, post-processing, particles, and sound can all be adjusted in the Inspector. After Claude adds an effect, you can change its values yourself and watch the result in Play Mode. The values you will probably change most are the fog Density, the Bloom Threshold, the particle Start Size, and the sound volume.

Further reading

Ted Liou

Ted Liou

Software engineer writing about Unity and AI development.

Comments