There’s no limit to how innovative today’s 2D games can be. With so many creative possibilities and the evolution of Unity’s 2D rendering and tools, we’ll keep you up to date on best practices for making 2D games in Unity.
Happy Harvest, now available on the Unity Asset Store, shows developers how to harness the latest capabilities for creating 2D lights, shadows, and special effects with the Universal Render Pipeline (URP) in Unity 2022 LTS. It incorporates best practices any 2D creator can use, including not baking shadows into a sprite, keeping sprites flat, moving shadow and volume information to secondary textures, advanced Tilemap features, and much more.
Happy Harvest is a top-down demo with cheerful cartoon art. The sample takes you through a day in the life of an industrious farmer. Stepping from his farmhouse, he makes his way along cobblestone paths lit by lanterns. He tends to wheat, carrot, and corn crops, picks apples, and feeds his pigs and cows. His farmstead is dotted with ponds, there’s a barn in the back, and it’s all ringed by verdant pine trees.
A top-down perspective comes with challenges like how to project the character, manage overlapping objects, and create shadows in an imaginative way. These were handled by using features included in Unity 2022 LTS for shadows, sprite libraries, and Tilemap 2D.
All of these assets are free to use in your personal or commercial projects, and you can also modify the demo with your own ideas. Download it today to start exploring this bucolic scene and its many details.
The demo is accompanied by a collection of instructional articles. These technical walkthroughs will help you understand how the lights, shadows, environment, and animations were created, so you can use the same steps in your own 2D project.
The following pages are available with the demo:
You can find these articles in the description on the Unity Asset Store page and in the in-Editor tutorial window in the demo.
Let’s take a brief look at what you’ll learn from each page.
There are plenty of cute details in Happy Harvest, from fields of ripened corn and golden wheat, to gently swaying lanterns and the red-shingled farmhouse. But it’s the lighting and shadows that are the most immersive part of this cozy world, featuring an all-over glow and late afternoon shadows.
By moving light and shadow information to separate textures (which does require some extra steps during the art creation process), you can create optimized real-time 2D lights and shadows.
Read the article “2D light and shadow techniques with the Universal Render Pipeline” to learn how to:
What do the cobblestone paths, ponds, grass, and background forest have in common? They were all made with Unity’s Tilemap system, which provides a way to create a game world with tiles – small sprites placed on a grid. Instead of designing a level as one big image, you can split it into brick-like pieces that are repeated throughout a whole level.
Tilemaps can help save time on art creation as well as memory and CPU power. This is because tiles can be rendered by a dedicated renderer and the tiles that are not visible on the screen can be disabled. A brush tool makes it efficient to paint tiles on a grid, and they can be scripted to use painting rules. They also come with automatic collision generation for more efficient testing and editing. Additionally, you can place GameObjects or use the API for game logic.
You can find tips for using the Tilemap system in the article “Create art and gameplay with 2D Tilemaps in Unity,” including how to:
With his rolled-up sleeves and pompadour hairstyle, the farmer in Happy Harvest is ready to work. To get him moving around the scene, we used techniques like rigging his face to create different expressions, sprite libraries for character variations, and Sprite Swap for switching between sprites attached to the same bone during the animation process.
In the article “2D characters and animation in Happy Harvest,” we break down these and other techniques used to create the animations. You’ll get tips on how to:
The farmer’s crops need both sunshine and rain. Luckily, the evening brings rainfall, and our hard-working farmer can retire to his little home with a cozy fire in the hearth.
There are different options for creating 2D visual effects like these in Unity. You can animate an explosion frame-by-frame or spawn particles and cloud sprites. Use the Built-in Particle System for particle spawning on the CPU. Alternatively, you can leverage the GPU and use the VFX Graph and Shader Graph to spawn millions of particles or apply post-processing effects with URP Volumes.
In the article “2D special effects with the VFX Graph and Shader Graph,” you’ll learn about the different techniques used to create the special effects in Happy Harvest, including:
Learn more about creating visual effects in our e-book The definitive guide to creating advanced visual effects in Unity. The e-book provides a complete overview of how to use visual effects authoring tools in Unity to create advanced effects, including water and liquid, smoke, fire, explosions, weather, impact, magic, electricity, and much more.
Happy Harvest is a playground for 2D creators who want to pick up new visual techniques in Unity. Expand on the sample, reuse its elements and scripts in your own projects, and test it on your mobile and desktop devices. This sample and its supporting content is designed to provide useful tips for everyone, from beginners to experienced 2D developers. Happy harvesting!
If you haven’t yet, be sure to download these advanced e-books that cover 2D game development as well as rendering and visual effects (3D and 2D) in Unity:
You’ll find many more resources for advanced programmers, artists, technical artists, and designers in the Unity best practices hub.