ME FIRST GAMES
games for me and you
Unity Levels - Scene or Prefab?
YOU must decide how to architect levels when you're developing your game.
Whether it's using a scene, prefab, or implementing a custom format for each level, it is not always clear what is the best approach.
📌 Before we begin, let's clarify that there is never a one fits all rule. As an effective game developer, you must look at your circumstances and make your own design decisions.
🚀 Scenes Using a different scene for each level is a classic solution. Before nested prefabs were a thing, a scene could be additively loaded and contain only game objects for the specific level. Unity allows for asynchronously (kind-of) scene loading. However, there is extra overhead that is included in scenes that is not necessary if you're additive loading, e.g. lighting data. Games that are not pushing the performance limit can still use this technique and never have issues.
🧠 Prefabs Using prefabs for levels is now extremely easy and straight forward. A level prefab can nest other prefabs inside of it, e.g. You can place your SlimyBadGuy prefab inside your level. Although the prefab editor is powerful, sometimes it can be flakey or confusing on what values are overridden or applied. Pro tip: set up a scene as your prefab editor environment so your level will appear as it would in-game. With prefabs, you also don't need to worry about referencing objects across scenes. Beware referencing all prefabs from your main scene and having all prefabs and dependent resources loaded into memory.
🚀 Custom Format This should not be your default solution, however, it's great if you are randomly generating the level data or allowing your players to edit or build their own levels. It may also be required depending on your performance requirements; with a custom solution, you can implement true asynchronous level loading where each object in your level is instantiated in different frames.
⭐️ Whatever you decide make sure it works for you and your skill set, performance, and scheduling requirements.
⭐️ Follow https://www.instagram.com/mefirstgames/
7/24/2021 10:17:36 pm
This is exactly what I needed! Great information! Thank you!
Leave a Reply.
Me First Games is an independent game studio dedicated to creating unique and bizarre video games.
Star Impact is an upcoming adventure platformer coming to PC, Mac, and Linux.
Copyright (c) 2020 Me First LLC