Intro To Unity

Hello! Welcome to Intro To Unity. This page functions as an overview of what we will cover during the course, full of links to resources and further reading.

Course Dates

The specific meeting dates for the A3 section of this micro course are January 20, February 3, February 10. The specific meeting dates for the B3 section of this micro course are February 16, February 23, March 2.

The course meets in Hunt Library room 106C, 4pm-6:50pm.

Course Description

This course is designed for students with little to no experience working with game engines as entry point into the field of game development. Students will learn the basics of the Unity3D engine, and to creatively and effectively build their own simple games. This course will cover topics such as navigating and using the engine, basic game programming in C#, user interface development and introductory game design principles. Students will be assessed based on the functionality of their games and will receive further feedback on their implementation, execution and creativity.

Table Of Contents

About The Course

This course takes place over 3 weekends. The final project is to make a game. The course is pass/fail, which means that how much you get out of the course is largely up to you. Ie: effort in -> knowledge out. There is a minimum passing amount to learn, so yes - if you have previous experience with programming, you will have at least somewhat of an easier time. I encourage you to explore more (and ask questions) in the direction of your interests, and focus on making sure you get the most out of the course.

Unity has a significant initial learning curve. The abstract goal of the course can be simplified to two parts:

  1. Provide an introduction to the fundamentals of the Unity Game Engine, Game Design conepts, and C# programming.
  2. Provide the "tools" to continue teaching yourself unity.

That second one requires further breakddown: I want to teach you how to teach yourself Unity. That means problem solving techniques, ways to think about situations, and the ability to navigate, filter, and utilize resources.

About Unity

What is Unity

Unity is a lot. Its's a game engine. It's an Interactive Environment Editor. It's a System for controlling states with user input. It's an input->output piping system. It's a complex digital media manipulator. It's a 3D environment with fluff. It's a platform.

Unity Makes Making Games Easier

With this goal, it makes making many things that are not games easier too. People make interactive art, live projections, apps, and, like, just SO MCUH with Unity.

Difficult things Unity makes easier: - Real Time 3D Object manipulation and display - Cross Platform Input Control - Camera Effects and Manipulation - Terrain Generation - Multiplayer Networking - AI Navigation and Pathfinding - 3D Sound Handling - Connecting to third party services - Animation (timeline, curves, frame-based, event triggering) - UI - Real Time Physics Calculations - Sprite Maps, Tile Maps, - VR Platform Integration - Multi-target Builds (write code once, publish anywhere)

This list is inexhaustive. Unity is a lot. Unity is extensisible, which means we can add code other people wrote to it. Not just game assets like 3D models, but things that make Unity itself more powerful. For example, a recent update folded a 3D modeling tool called ProBuilder into the official release!

Games made in Unity

What Unity Is Not

While Unity makes making games easier, it does not make making games easy. It cares about lowering the technical bar (and the "tedius" bar, if that's a thing) to executing game design. It does not care about lowering the conceptual bar to executing game design.

It is just a tool. It's an interface. It's piping. It does not create assets or design things or implemenet mechanics. It will not realize your dream for you.

The asset store is good... but it isn't great.

Prerequisite Knowledge

There are some things you need to know before you take this class.

  1. You should play video games. Play some games this week and think about all you can with crafting the experience you are having.
  2. You should understand 3-Dimensional spaces. This means algebra but probably not calculus. You should know how we represent 3 dimensional spaces on 2 dimensional screens. Keywords that you should have an understanding of: (axis, x,y,z, perspective, orthographic, depth of field, speed/velocity/acceleration).
  3. Cartesion Coordinate Systems. You should be able to represent an objects position in 3 dimensional space on an XYZ grid, and how we talk about it.
  4. Vectors. You need to know what Vectors are. You will not need to, yet, understand euclidian angles, which Unity also uses. Here's a video about Vectors. You need to know what it means to add Vectors together, and what it means to multiply a vector by a number, and what it means to "normalize" a vector.
  5. Basic Software and Computer Skills. I will be talking quickly about user interface elements, keyboard shortcuts, alt-tabbing around, file types, folder structures, and lots of other computer things you should know.
  6. Researching and Documentation Using. You should be able to google things real good, and filter out bad, unrelated, and out of date information. This will get easier as you learn more about unity and programming. You need to learn how to ask the right questions, anbd you should have a general idea of what that might mean.
  7. Be able to have bad ideas. You should be able to fail gloriously. Lose well. Embrace weirdness. Look at ugly things and see the little beautiful thing inside of them. You shoul dbe able to come up with a list of 10 ideas where 10 of them are really bad ideas you are not proud of.
  8. You should have unity installed before class.

Installing Unity

Unity updates regularly, on a 3 month calendar. This is a new update schedule, it used to be occasional versions. So you used to have Unity 4.1, 5.4, 5.6, so on. Now it's 2017.1, 2017.2, 2017.3, 2017.4. There are four stable ("LTS" or "Long Term Support") releases they will put out each year.

You can use any version of Unity that is at least version 5. If you don't know, get the most recent non-beta version. If you already have one installed, then your don't have to worry about messing with updates. Consider updating to 2018.3, as I will make source code for projects available.

Unity is free, but you do need a Unity account.

Generally, developers will use one version of Unity for a project, and not risk updating during that projects development. Many developers have multiple versions of unity installed. It's sort of a running gag in the community. Unity recently made this mess easier to manage with something called the Unity Hub. It manages multiple versions of Unity, and helps manage projects - making sure you open them in the right version. If you are installing Unity for the first time, install the Unity Hub and 2018.3.2, which is the most recent stable version as of me typing this.

Go to this page and click "Download Unity Hub (Preview)", and with the hub, install 2018.1 (beta). For Add-ons, make sure Windows Build Support is installed.

Setting a Text Editor up with Unity

Unity is NOT a text editor. The coding will be done in another piece of software. You can use lots of other pieces of software. You can use notepad.txt, or vim, or emacs. I recommend none of these.

I recommend Visual Studio Code. Not to be confused with "Microsoft Visual Studio" (which also easily supports unity). It's nicer looking and easier to extend than MonoDevelop, and has the easiest and clearest instructions to setup with Unity. (ie: don't use sublime or atom unless you already use them and know how to mess with packages).

Great Color themes for most editors: Rainglow. (I like earthsong).

The Course Has Three Parts

  1. Unity, The engine
  2. C# Programming
  3. Game Design Concepts

I assume no prior programming knowledge. Many of you will have prior programming knowledge. This course will be easy and slow at times. That's fine. Work ahead while I talk. Feel free to not follow along while very bored, but run off and challenge yourself to do something interesting in Unity.

Course Topics

What we will cover, and links to resources/videos that also cover this. The course is interesting because there is really no ideal order to teach things in. I have to start with a whole bunch of seemingly disconnected things that won't make much sense until more things start to fall into place.

But don't worry, get past this initial phase, trust that I am teaching you important things, and one day it's going to start clicking.

Please please please jump around, follow you interests, and dig around in the documentation.

Week 1

By the end of the class, you will have a project that is similar to if you followed this online tutorial.

You may want to check out this Interactive Tutorial too.

Week 2

Week 3

Assignments

Assignment 1: Make a level for the ball rolling, become an expert on ONE RANDOM SMALL THING, and incorporate it into the ball rolling game.

Assignment 2: Make a mechanic, Watch a Mark Brown game design video and be ready to talk about it.

Final Assignment: Make a game. Information below.

Resources

Most unity resources exist on youtube. Sadly, this is not usually an -efficient way to learn, as most educational youtubers tend to go very slow, explain things poorly, merely talk aloud as they work, are just bad or all of the above.

My most important piece of advice is to search the unity Manual and the Scripting API before googling the open internet. Always always always. Open the page of the official docs on a function before googling how to use it.

Links to youtube Series on Unity that I think are at least okay:

Assignment Information

Assignment One: Level/Become an expert on one thing.

Three parts. All fairly simple.

First, watch a video on game design by Mark Brown or [Game Array]. Don’t pick Boss Keys, but otherwise it’s up to you. Find one that looks interesting to you and give it a watch.

Mark Brown/Game Makers Toolkit.

Game Array.

Second, make a level for your roll-a-ball game. A beginning, a middle, and end. What qualifies as a “level?” what makes levels good? Do your best, and during class this Saturday we are going to talk about level design, and use our successes and failures with the roll-a-ball as a jumping off point for that conversation. The point here is to open unity, add a bunch of blocks, and practice moving them around.

Third, the real meat of this weeks assignment, you are going to look up and become an expert in one very small thing in unity, and implement it with your roll-a-ball level. Theres a list of ideas below. Some easier than others.

That’s all. This assignment should take about half an hour plus watching a youtube video. If you find yourself really struggling or taking longer (and it isn’t because you’re challenging yourself with something harder), try to meet with me during office hours and I’ll help clear everything up.

IDEAS - Skyboxes (what's a cubemap? What's equirectangular?) - Collision events! OnCollisionEnter() (a platform that falls after you hit it; by changing rb.usegravity) - Triggers and OnTriggerEnter() - Playing a sound (make a crazy piano) - Physics materials. Make a bounce platform! - make Item Pickups - An object that rotates as an obstacle, like a windmill on a minigolf course. - Add various lights of various types and edit and adjust them to make a good-looking level and not necessarily like a disco-wonderland. - Emission Materials and Static Objects. - Tag's Getting all items by a tag and doing something with that. - Layer Masks (and physics collision layers) - Navigation, NavMeshes, And NavMeshAgents, - Unity's Terrain tools - Make the ball have color Selection (change material.color on button press, or maybe just activate and deactivate child objects). Also, activating and deactivating objects. - Trail Renderer component. It's wonderful. (and easy and fun) - Particle Effects. (Be warned, it's easy to get something but hard to get something good. Lots of tweaking and fiddling) - Importing and using textures (make a texture in photoshop (filter>render>clouds, filter>noise>add noise, gradient map, etc); don't use asset store for this. - Import a 3D model and put it inside an invisible sphere (collider), or a super-monkey-ball style mostly-transparent sphere (bonus points for you) - Restart the level on: (easy: a reset button press. harder: collision with a block that has the 'Goal' tag. that you create). - Unity UI and the ever-obtuse rect. Transform., add some overlay text.

Assignment 2: Implement A Mechanic

Brainstorm a handful of ideas for games and their mechanics. Implement a half-working game mechanic in a Unity project.

A what-now?

Pick a game genre. Any game genre (say, platformer). What are the verbs? The actions? What the player can do? In a platformer, that’s run and jump. What are the behaviors? Well, we can single or double jump but no more than that. And the player changes direction instantly, they don’t slide around on the ground usually.

Okay, make just that. Move left right, jump, jump again, don’t be allowed to jump more until you touch the ground again. That’s the mechanic.

So some booleans or int’s (canJump, times Jumped) and some if statements (when input, if (canJump==true), jump); and some collision checks (when we hit something, canJump = true).

There. Mostly working. Done. Close Unity. Go outside. Relax. Play some games. Watch more youtube videos about game design. Sure, this player can jump again when you touch the sides of things or if your player hits their head on the bottom of a platform but… solvable problems. that’s why this assignment is a half-working mechanic, not a fully implemented mechanic.

Puzzle game? Try making item pickups as the mechanic (bool hasKey = true).

Shooting game? Instantiate a bullet from a prefab and give it a force in the direction the player is facing. Can they shoot different types of bullets? Right or left click for now is fine, “gun switching” sounds like more work we don’t need to tackle right now.

Flying game? When you collide with something you should die and maybe spawn some crash particles and make a timer and restart the level after a second or two. Oh man, coroutines! IEnumerators! Fancy!

Gravity controlling puzzle game where you try to get different items into different containers but they all react to your input? One script with a public vector2 that takes the player input, another script you can put on any game object that gets that vector2 (hmm, accessing other script properties? A thing to learn!) and adds the force to itself.

Lemmings game? Make a basic AI that walks forward and turns around when it hits something.

A mechanic where the player has a flashlight and can only use it for a limited time to see anything. Timers! Also known as numbers that count up!

A super monkey ball game where… the player is a rolling ball …(wait no. don’t do this one. No more rolling balls!)

A pinball game? Rigidbody has a nifty AddTorque function. It’s basically addForce but… the object spins instead of moves. But the paddle spins too far? Okay just stick an empty game object with a collider to block it. No code required. Oh wait, the ball hits that thing now? Time to google that “collision layers” thing. (Also maybe physics materials to give things varying degrees of friction and bounciness)

I don’t care what your mechanic is. I just want you to practice implementing a behavior into Unity. I’ve given some ideas above, but part of the assignment is the “what should I do?” and the “how do I do it?” part. I care more about this abstract from-idea-to-logic problem-solving puzzle than your coding ability.

Come to class with something that doesn’t work at all, but you can tell me how you would make it work if you could just figure out how unity does xyz? You’ll still get credit for the assignment if you can show me your attempts.

This assignment should not be a lot of coding work, and if it your idea IS a lot of coding work, simplify it or just ignore parts of it for now (again, half-working). This assignment IS brainstorming an idea for a game mechanic, and puzzling out how might you use basic game logic and functions and scripting to turn that into a reality.

One last thing... Unlike roll-a-ball, you can end up using this for your final project (a game), if you choose.

Final Assignment: Make a game

You will submit a Windows Build of the game (so that I, a windows user, can play it). You should also submit a mac build so everyone can check your game out.

You will also submit a "readme.txt" (or pdf or html or whatever) file that includes your name, information about the game, how to play it, the controls, any credits for anything you have used that you didn't make even if it's public domain, and anything else you want me to know about it before I play.

Thats what I expect. A windows game build and instruction file. NO instruction file? You fail the final assignment. Oof.

What do I mean by "a game"? More like "The Bones of a game". You don't need a menu or multiple levels (probably, but you need a level that has a beginning, middle, and end), and you don't need an instruction/tutorial section. I will read your readme's before playing.

First, some ground rules.

The game must demonstrate the following things:

Question: What about an alternative non-game post-game art-game poem-game? Golan Levin showed me this work by Everest Pipkin, and i'm so inspired!

Answer: No. Go off and do that next, I love it. But this assignment is a game. A game game. No subverting expectations of interactions with games, or whatever.

Question: **I made a roll-the-ball game. ** Answer: You have done nothing.

Question: My game doesn't work/isn't finished! Answer: You must submit SOMETHING by the deadline. Submit the broken game. Do not submit nothing. Email me and ask for an extension and explain why. I will only consider granting an extension if there is a submitted, unfinished/broken game in the folder.

Question: I followed this online tutorial step-by-step! Answer: Literally cheating. Fail.

Question: My game isn't done, but look at all of the amazing 3D models I made for it! I spent 3 straight all-nighters working on the main character. Answer: Good job! Except you didn't do the assignment. Fail.

Submission Guidelines

In the shared BOX folder, you must have a "Your Name" folder.

Inside that folder, a "Windows" subfolder for the windows build. (and, hopefully but not technically required, a "Mac" subfolder with the mac build).

Inside that folder, a zipped (.zip) file containing:

for windows, and

for mac.

Inside the "Your Name" folder, you must have a readme file (gamename_readme.txt) that explains the following:

Advice

Again, please submit a broken game over nothing. It may even be enough to pass, even if it doesn't live up to your goals.