What is the best way to organize a game?

My game (2D) will have multiple levels. Some of the graphics are shared between levels, especially the HUD! My game will also have a title screen show up after the Unity logo and before my main menu. How would I structure this so that I can share things?

I know I need to use multiple scenes but how does the shared HUD work?

Thanks experts!

PS: Are there any good up to date 2D tutorials? My game will be 2D but I want to take advantage of 3D models and physics

I have a first little bit of code for you.

http://thecreativecoder.blogspot.com/2010/06/unity-2d-side-scroll-script.html

Apply it to the camera. Then set the target to your character. the variable Z is how far away the camera is.

Thanks!

I looked at the tutorial but still have questions. What is the best way to organzie multiple levels. Some of the graphics are shared between levels, especially the HUD, how do you guys handle this?

THX

I’m not sure what you are asking…you don’t need to do anything special…just create a new scene (level), design it, apply your assets (textures, objects, sounds, scripts, ect… from the Project tab).

As for organization I just name my folders such as _Script, _Prefabs, and so on. To share the hud either make a prefab of the camera with all the scripts and hud attached and import it into every scene or just apply all that to your main camera when you make a new scene.

I want to share the code and graphics for my HUD across all my levels. If each level is in its own scene, what is the best way to share the HUD without any duplication? You could call it global variables…

Anyone?

Have the GUI components added to each scene? Is that too simple of an answer? Or are you asking about persistent variables?

From the help files:

I usually have one scene called Game (or sometimes Engine - since I’m inconsistent).
It has all the shared stuff (player object, HUD, some prefabs, some pools with reusable objects, etc).
This scene then loads a Scene with the level (ie Level1 etc). This level then loads a Scene with assets that are shared between multiple levels (a theme - for instance, the first few levels all have the same enemies, so these enemies go into the Theme1 scene).

I don’t think there would be any duplication would there? Or am I just not reading/thinking about this right? If your hud consists of say 3 textures and 3 scripts and you set your hud up in your current scene, then you create a new scene and you use the same textures and scripts…there shouldn’t be any duplication, would there? It’s just the same objects/components being used at different times (Level1, level2, and so on)

Unity works like a programming language, whatever classes or objects you use in each scene is compiled to a specific part of the assets. Each level file then contains information about what assets to load and where. So when you make your game even though you have 8 levels with 8 player objects (one for each scene) only one player object is saved as an asset and is then instanced at proper load time. Don’t worry about optimizing file sizes Unity does that for you, just use prefabs whenever possible to avoid object duplication.