for engineers
background image credit: all-free-download.com
so much windows
image credit: gamedevacademy.org
A scene is the basic file you are working on in Unity.
A scene is made up of GameObjects.
It's just a container for components.
You can make a GameObject act like a light, a camera, etc. by adding the right components.
Everything you can see in the Hierarchy or Scene is a GameObject.
Everything you see in the Inspector is a Component.
It's good practice to use empty GameObjects to group your GOs and keep your Hierarchy tidy.
But notice that a child GO will inherit its parent's local transformation matrix – rotation, scale, etc.
When you're scripting Unity, you're not running the show. You're hooking into Unity's core loop.
Here is a simplified version showing the overall order of the loop.
Unity gives you named methods to tie into different parts of its core loop from code and tell it what to do.
You can find the whole list of hooks by searching for "MonoBehaviour lifecycle".
Engineers often want to roll their own physics, etc., rather than understand how to tie into Unity's events.
This is usually not a good use of your limited time.
Pro tip: Understand the difference between FixedUpdate and Update.
Notice that Update is tied to the Input phase. FixedUpdate can run several times per frame.
It's common to set flags in FixedUpdate and then respond to them in Update, and vice versa.
This is a symbolic representation of GOs in a hierarchy.
Unity also keeps lists of relevant active components for the different parts of its core loop.
So in the physics loop, Unity starts by dispatching FixedUpdate to all MonoBehaviours. Then it finds all the physics system components.
It finds all the Rigidbody components and updates their position, velocity, etc. It looks for collisions and dispatches OnTriggerEnter, OnCollisionEnter, and so forth to attached MonoBehaviours.
Then it finds all the MonoBehaviours and calls Update.
Then it finds all the renderers and updates them, dispatching various rendering events.
There are other built-in Unity components for networking, animation, pathfinding, particles, audio, etc.
You're likely to use:
Every collision requires three components:
There are two types of collisions:
For animated characters you will often have a Rigidbody on the parent GO and then several colliders on the children (arms, legs, etc.)
If you do this, stick test scripts on all of the different GOs and make sure you understand which objects are getting the messages.
Don't fight it.
Here are things you can do as an engineer:
The Unity Asset Store isn't just models. There's things like
third-person character controllers
and much more.
If it's a popular asset, that means it has already been tested extensively and will likely have features you wouldn't have time to write.
Add, remove, enable, disable, modify components
Create and modify a Material
Getting around in Scene view
"How to make a Video Game" by Brackeys is an excellent quick start, with 10 short videos of <15 minutes apiece.
This is a curated collection of resources for learning more about/getting better at Unity and game development.
It's primarily meant for students just finishing my Intro class, but there's useful links for all levels.
I particularly recommend
"Learn Advanced C# Scripting in Unity 5 for Games".
This page offers a pretty comprehensive overview of tutorials and resources for Unity, and it's frequently updated:
XR Unity Tutorials List
I particularly recommend these sites:
Ray Wenderlich
NoobTuts