Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Book for Experienced Develoeprs

Discussion in 'Community Learning & Teaching' started by dogjones, Sep 1, 2014.

  1. dogjones

    dogjones

    Joined:
    Jun 20, 2014
    Posts:
    1
    I'm looking for a book / other resource which will be useful for an experienced programmer / game developer. Something with no information on how to start programming, or information on concepts such as collision detection and so on. I'm looking for information on how to structure unity projects, information on design patterns which work well with unity, how unity works under the hood (for optimization concerns), and the mechanisms which unity provides to solve common problems when implementing games (so I don't reinvent the wheel when I don't need to).

    There are so many books with an "introductory" tone that I am finding it very difficult to find a resource like this, anyone have any suggestions?
     
    GarBenjamin likes this.
  2. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    Such a book would have been very nice to have when first starting with Unity. I know exactly what you mean because in the beginning I spent a lot of time completely throwing out my code and restructuring it in a way that made more sense to me. I probably ended up doing it in a way that is different from most people but it works and makes sense to me.

    Basically I have a few singleton classes such as my game manager, object pooler, sound system etc. For each object (player, enemy, collectible, etc) I create two classes. One a monobehavior for the game object itself that handles positioning, setting the sprite image, etc. The other class is the behavior class. For example, an enemy has an EnemyGameObject class and an EnemyBehavior class. The reason I did it this way is so I can easily swap the behavior when trying things out. If I want to make a different behavior for an enemy I just write the nee behavior class and replace its behavior object with the new behavior.

    I think it is very important to separate the Unity specific bits from the behavior. That is why I have a WhateverGameObject class for every object. The idea being if I decide to port the projects to something else the behavior will remain the same and I only need to update the very lean GameObject classes to work with the new engine.

    There was a time when I broke down all of the behaviors into multiple very specific dedicated behavioral classes (MobileObject, BreakableObject, CollectibleObject and so forth) and used interfaces. But I thought that was overkill. I always prefer simplicity above all else.
     
    Last edited: Sep 4, 2014
  3. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I'm still dreaming of books without newbie chapters too. Even books I've bought on relatively advanced subjects spend about 20% of the pages on introductory subjects. Even Practical Game Design with Unity and Playmaker wastes many pages on Unity workflow.

    One book that stands out as a shining example is Unity for Architectural Visualization (Packt Publishing). It spends 28 lines across three paragraphs talking about Unity's workflow in general terms ("it's originally for games"), then straight to BIM and other fun stuff.

    Another gold standard of writing is Unity Shaders and Effects Cookbook (also PacktPub). I couldn't find any newbie material at all. It starts with shaders from the first chapter.
     
  4. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    I'm writing a book about Unity that's targeted at experienced programmers. It assumes you already know how to program in order to move faster; the book isn't completed yet, but early release chapters are already available at www.manning.com/hocking
     
    GarBenjamin likes this.
  5. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    btw Deal of the Day September 10: Half off my book Unity in Action. Use code dotd091014au
     
  6. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    That's cool. I am seriously considering writing my own book. I have wrestled with Unity since first trying it last winter. Things I could accomplish in minutes with other APIs and engines I battled for days with Unity. And I get tired of seeing all of the fragments and "cheap" frameworks being used in tuorials. It's like everything is hard-coded for the specific tutorial. No real architecture considerations at all. Things like that I spent weeks on trying different ways to architect my projects. It is kind of what I am building my 2D platform game for. To serve as an example of the issues I ran into and how I approach this stuff now.

    Anyway, best of success with your book!
     
  7. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    I'm curious, what sorts of tasks? My experience with Unity has typically been the opposite (things are way faster than what it used to take) but then I'm not necessarily talking about deep code architecture.
     
  8. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    It may be due to me jumping into 2D with sprites but to me the workflows and the little glitches cost a lot of time.

    For example, several years ago I worked on a scrolling space shootemup in C# and XNA. At that time, I just drew the graphics or modeled them in Blender. Put them on a sprite sheet. Loaded the images and away I went. I could focus on coding straight away and getting stuff done.

    With Unity3D it was like stuff was getting in my way. The Animations for example. If it was the Legacy style that would probably work but by the time I got in they had added an Animator. To me it was just a whole new layer inside of Unity that I needed to mess with. Granted it is very much like what I knock out in a diagramming tool for the states but the thing is I do that stuff myself "outside" heck sometimes even just on paper. All I needed was to load in the dang images, set up the animation tables in code and display them at the correct time. Personally, I don't even use the built-in animation system or the physics system. I just need a way to present graphics, play sounds and music and that is it. Give me that and I will then jump into the code to handle all of that other stuff. I realize I am probably in the minority. lol ;)

    Anyway, then I ran into several issues regarding "tearing" between the tiles. I never saw this issue when I used XNA which also is all in 3D even when developing a 2D game. Drove me crazy trying to sort it out and took a ton of research reading numerous accounts online from people experiencing the same issue. Of course, now that we (myself and some great people here including a Unity person) figured it out it is no problem and I can deal with it up front. But the thing is there was never any mention of proper preparation for using 2D graphics in any of the docs I had read beforehand.

    Then there is the architecture part. If you look at most tutorials and other snippets the focus is nearly always on "look at the flashy effects that can be made in a dozen lines of code"). I get the focus is on illustrating the subject of whatever the tutorial is about but you certainly would not want to develop a full "real" game like that. At least I wouldn't.

    Other things as well. Basically, just stuff you need to learn of course. But it was surprising to me how I kept running into one thing after another and often spent days searching trying to find out why.

    I imagine every person's experience is different. Which is why there are dozens, if not hundreds, of books on game design and development. Heck there are hundreds of books on C# alone. Because we all see things a little differently and for each of us there are X people out there who can relate.
     
  9. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    People always kept bragging about the great documentation for Unity. It's somewhat exaggerated. I think newbies are also confused by the fact you have to jump over to Microsoft's site for C#/.NET documentation, which follows a slightly different layout (and possibly style too).
     
  10. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    an fyi on my progress: I just submitted the final changes to Unity 5 for my book, so the updated manuscript is complete! Now there's just proofreading and the actual printing process remaining; I would estimate just a couple weeks between now and when physical copies of the book are shipping.