Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Tutorials on game structuring within Unity, loading/end scenes, Managers and DDOL, etc...?

Discussion in 'Getting Started' started by stain2319, Mar 11, 2021.

  1. stain2319

    stain2319

    Joined:
    Mar 2, 2020
    Posts:
    417
    I'm curious if there are any good tutorials on this stuff. There do not seem to be a lot of tutorials out there that deal with the transition, if you will, from a "scene" where you can do stuff in play mode to an actual built "game". I've seen a few here and there that are scattered about but nothing very comprehensive or top-to-bottom I guess.

    I'm having a hard time articulating this so forgive me if I'm kind of all over the place, but I guess what I am getting at is -- tutorials seem to be abundant for "how to do X mechanic in Unity" but I've not seen much for buiding the sort of "nuts and bolts" of a game, like how to do:

    - loading/intro screens
    - start/options menus
    - how to ensure your level is built before your player appears in it
    - choosing spawn locations for your player
    - end credits

    Plus all the things that go into making your game a playable, "standalone" game instead of something that always gets run from Play Mode. I feel like every game I end up making there is this weird thing where, when you start the game, it's like everything is still "building" for a minute so you can see part of the terrain, objects popping in, etc then your player finally becomes "active", because there's no "pre-loading". Like, in most games you have a loading screen, with some tips and tricks about gameplay, "please wait..." and then it fades in and by the time it does, everything is 'ready go to' and there is no weird pause with your player not being controllable for a minute -- does anyone know what I am talking about here? LOL...

    I am thinking of games like Stranded Deep for example - where you have a whole series of things that happen like building the map, placing objects, etc before your player even gets instantiated; or the menus in The Long Dark where you choose your starting area (or "random") area, or even Valheim where you have a world seed you put in and then you have some loading screens with tips....

    whereas all the tutorials and things on Unity basically seem to have this "one scene" approach where you just start out as a character "in the world" and you're already in the action, so to speak. I have not seen anything (or very much) that talks about "how to make your game behave like a game" if you know what I mean.

    But that is just one aspect. There are a lot of other things I feel like never really get covered (or I am looking in the wrong places and searching on the wrong terms.)

    For example, I've gleaned some information along the way about various ways to do things like the "Grid.cs" approach where you have some objects/scenes with Don't Destroy On Load and these handle your player inventory from scene to scene, or having a "master scene" that loads all your other scenes for you, and so on, but all of this stuff is really vague - it's like they assume some level of knowledge that I don't already have... and there is really nothing "official" that I can find or any sort of "how to" tutorials with regard to this stuff that "surrounds" actual gameplay, like managing your scenes, loading/intro screens, managing sounds, more nuts-and-boltsy stuff vs "how do I make a clickable button" or "how do I make a character controller" and so on. There are some assets on the asset store that seem to do things like this but most of them seem to have very little in the way of step-by-step "how to actually use this in a game" instructions.

    Another example - I do not think I have ever seen a tutorial that talks about adding different scenes to your build other than a brief mention like "make sure to add all the scenes to your build" but there is never any explanation about what you are doing, how to designate a master scene or loading scene, basically how to actually "build your game into a game"...

    Am I making sense? Can anyone point me in a direction to help me learn more about this stuff? Preferably some tutorial(s) where someone demonstrates this start-to-finish? I'm thinking of something along the lines of RVR's Game Creator tutorials I guess, where you start with an empty scene and end up with a game -- but even that tutorial seems geared toward people for whom a "game" means you just start it by pressing "Play" in the editor and doesn't seem to deal with making it a standalone experience.
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I feel this post. I was there before, and I remember becoming very frustrated at struggling to move from "I can make a game-like thing" to "I made a game."

    It's my opinion that Unity Technologies doesn't provide this kind of tutorial because they don't make games. Just from some of the API documentation I've seen, there doesn't seem to be a consensus within their team on the "standard" way to do certain things. Whether this is intentional ("It's on you as the developer!") or just due to lack of experience or knowledge on that front isn't clear, but I don't think it matters.

    Some of those elements are missing because they're comparatively trivial. If your game is big enough with a large enough team that you have a whole list of credits to scroll, adding that in should be nothing. Some of them are things that are dependent enough on the specifics of your game that creating a tutorial is a somewhat fruitless endeavor, since what works on one project might be entirely insufficient on one that differs only slightly in execution. In these cases, it's useful to be familiar with all the tools at your disposal (for example, the LoadSceneAsync function for loading levels in the background while you show a loading screen), and only experience can make it clear to you how to handle it specifically for your game.

    It's a painful process, and I don't know a way around it. Tutorials are great for learning simple concepts and specific tasks, but making one that covers how to make an entire game... kind of by its nature only teaches you how to make that specific game, if that makes sense. Yeah, you can use your scene instead of theirs. You can make a Pong clone instead of an Asteroids clone. You can throw this feature in that the tutorial didn't cover. But once you start pushing those boundaries out a bit further, it's likely you'll find the framework prescribed for structuring and organizing your game doesn't work for you anymore.

    But just because what works for some might not work from you doesn't explain why no YouTubers haven't made successful series on making a full game, right? Content creators don't shy away from making videos claiming to teach you everything you need to know regardless of how true it is, so why the severe lack of tutorial series on building a full, complete game framework? That one's easy. Because building a game is freakin hard. I've been a developer for over 10 years now and working with Unity for nearly as long. And even still, I find myself constantly looking at things I've done previously and found them sorely lacking. I've built systems to handle menu navigation, character creation, planet generation, level editing, and pathfinding, and in nearly every situation I'm unhappy with the solution I came up with by the time I've finished making it work. It might just be that the pros who are really good at making full-featured systems and structures for an entire game are, you know... too busy actually creating games to be teaching everyone else how to do it.

    At work, we use Entitas, which is a third-party ECS system. Besides that, we have some methodologies and practices for structuring and organizing things that makes working with all these different systems really clear to me. But even still, I recognize that it's no small task to adapt it to everyone's needs or even preferred style. I'm using the general structure of how we manage our work product for a side project of mine, and I've had to adapt a lot of things, add new systems, and cut entire chunks of code out to make it work for me. I'm having trouble picturing how you could make any tutorial that says "build your entire game exactly like this, unless you need something slightly different in which case you might have to change everything", you know? I know it feels like I'm copping out, and it still feels reasonable to think someone should be able to tell you how to put it all together, but like I'm fond of saying: there's no shortcut to experience. You just have to try it, figure out what works and what doesn't, and adapt from there. Do it enough times, and it'll all click with you. You'll develop your own thoughts and principles on the matter, which you'll also shift over time and adapt to meet the needs of different projects.

    You just gotta stick with it. Don't be afraid of doing things the "wrong" way. You'll lose more from inaction than you ever could by doing something that isn't perfect. Keep going, keep breaking things, and keep fixing them. You'll eventually get to where you're trying to go, even if you don't realize you're there.
     
    Joe-Censored likes this.
  3. stain2319

    stain2319

    Joined:
    Mar 2, 2020
    Posts:
    417
    Thanks for the reply, I really appreciate your insight.

    I get what you're saying and I don't think it's copping out necessarily - it makes a lot of sense - but I guess what bothers me about it that a lot of times when I am 'trying things out' like this I kinda feel like I'm trying to reinvent the wheel, and it bugs me to think I'm spending so much time sort of "engineering" things for myself that I feel like seasoned game developers must already know how to do.

    I'm doing this as a hobby - I have a good career and no illusions that I'll ever make any money or work as a developer, nor do I really want to, so it's important to me not to spend so much time on the "underneath it all" parts when I can help it. I'm happy to buy an inventory system from the asset store instead of making my own but it seems like this area we're discussing in terms of taking your game from a "game-like" thing to a game is one place where there's a sort of gap.
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    There certainly are frameworks on the Asset Store that handle common tasks like we're discussing. The issue, I think, is that it's often just as much a chore to learn the specifics of those systems and adapt them to your needs as it is to just sort it out yourself. I've looked at a few in the past and couldn't find any that seemed to be right for me, but who knows... you might find the right one for you if you look hard enough.

    I think it's also important to keep in mind, given your circumstances and what you're looking to do, that you don't always have to do things the "correct" way, you know? If you do something and it feels hacky, but it works, then it's not wrong. Yeah, it might make it hard to scale or maintain at some point in the future, but if you're doing it as a hobby, that's just another learning exercise you get to go through!

    Don't get stuck in analysis paralysis. Just keep moving forward.
     
    stain2319 likes this.
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    In a way, I think it was actually easier on new users of Unity before they started creating all these hand holding tutorials. Tutorials generally focus on the basics and don't get into advanced topics for a few reasons. Advanced topics are usually a lot more dependent on your specific game as to how you would implement them, so a tutorial would be more difficult to generalize. Advanced topics would expect more experience/knowledge with Unity than a basic tutorial would, and would probably take much longer to get through.

    The old fashioned way to learning these things was going through the manual, the scripting reference, looking through forum threads for helpful discussions, and is what you need to do still. But when you walk through tutorials instead of learning this stuff on your own more or less, at some point the tutorials let you off the train and you have no experience with using the manual and finding the answers yourself, which you otherwise would have built up getting this far without the tutorials.

    But on your specific questions, some of that is handled through additive scene loading, and as already mentioned loading scenes async. You have your loading scene, you additive load scene after scene without activating them yet, and when all the additive scenes are done loading that is when you activate them all and deactivate the loading scene. If your new scenes have some work to do over the first few frames to finish setting up the level, then maybe you have the loading scene stick around a little longer, or I like to start the scene entirely black and then fade in over a couple seconds to buy myself a little time to get everything settled.

    I don't know if there is a tutorial on additive and async scene loading. There wasn't when I needed to learn it. The problem for a tutorial is, how do you separate your scenes? That kind of depends on what is different between the different levels or areas of your game. Maybe the UI is the same everywhere, as well as the basic functionality of the game, so you have that as 1 scene. Then the actual terrain and spawn points are different, so you have several different scenes for those. But your game could work totally differently than that, maybe your game always takes place at the same location, but the way you play the game always changes, like the first level it is an FPS, the next level you're flying an aircraft, the next level you're in a submarine, all with different controls and different UI. So you'd organize your scenes differently in that case.
     
    Schneider21 and stain2319 like this.
  6. stain2319

    stain2319

    Joined:
    Mar 2, 2020
    Posts:
    417
    Thanks for your input. I get what you're saying, although I personally dislike the style of the Unity manual and try to avoid it if alI can :)

    I think I'm not necessarily looking for a whole entire walkthrough (although that would be handy) but you mentioned a perfect example actually...

    This is the exact thing I would like to see more tutorials on. How do you even start a scene black and fade in? That's the type of "nuts and bolts" stuff that I'm having a hard time figuring out in a lot of cases. I wish there were more tutorials on that stuff instead of ten thousand tutorials for how to make choppable wood. I can figure that part out, that's just logic and animation... it's the "how to use the engine" stuff that is elusive to me.