
This educational sample project demonstrates how you can use ScriptableObjects in design patterns and game architecture to make your project more modular and artist-friendly.In the Paddle Ball sample project you will find examples of how ScriptableObjects can help you create components that are testable and scalable, while still being designer-friendly. Although the gameplay we demonstrate could be built in a simpler way, the purpose here is to show ScriptableObjects in action in a well-known, popular type of game. In most cases, the code examples favor clarity over conciseness as an educational project.It’s intended to be explored together with the free e-book, Create modular game architecture in Unity with ScriptableObjects. Getting Started with the projectThere are two parts to the project:The code examples of design patterns that show how ScriptableObjects can solve recurring problems in Unity developmentThe mini games that show how to put these patterns together into small working applicationsTo start the project open the Bootloader_Scene scene. Make sure to Read the six mini-guides listed below to understand the implementations in the demo.Design PatternsThe design patterns using ScriptableObjects that are included in the project are:Data containers: How to store static data for use at runtimeDelegate objects: How to encapsulate interchangeable logic into its own ScriptableObjectEvent channels: How to help your objects communicateEnums: How to use a ScriptableObject instead of a traditional enum for better comparison operationsRuntime sets: How to store frequently accessed objects or components from any scene without the need for a singletonMini gamesThe project includes several variants of a basic paddle and ball game to illustrate how to put these patterns together into functional game systems:Classic: Shows a basic implementation of ScriptableObjects in a classic paddle and ball gameHockey: Shows how to define custom wall positions using serialized textFoosball: Shows how to use a prefab definition for the level wallsRead the six-part guide with the demoThese six articles will provide you with a full understanding of what's shown in the demo:Separate game data and logic with ScriptableObjectsUse ScriptableObject-based enums in your Unity projectUse ScriptableObjects as delegate objectsUse ScriptableObjects as event channels in game codeHow to use a ScriptableObject-based runtime setFor additional examples of what is possible with ScriptableObjects, please see the following:“Overthrowing the MonoBehaviour Tyranny in a Glorious ScriptableObject Revolution”“Game Architecture with ScriptableObjects”Learn more advanced coding best practices in UnityThe ScriptableObjects e-book is the third in our series of advanced guides for Unity developers. Each guide, authored by experienced programmers, provides best practices for specific topics that are important to development teams.Create a C# style guide: Write cleaner code that scales guides teams in developing a style guide to help unify their approach for creating a more cohesive codebase.Level up your code with design patterns and SOLID highlights best practices for using the SOLID principles and common programming patterns to create scalable game code architecture in your Unity project.We recommend that you open a new empty project to view this sample project because it imports assets into the root/Assets folder. Note the project uses a bootloader script, meaning you want to load the Bootloader_Scene scene.The project runs in Unity 6.1 or newer versions.