Skip to content

Solar System Activity 🌍🌞

Xander Grabowski edited this page Oct 24, 2024 · 3 revisions

Navigating the Unity Editor 🗺️

Layout Views

  • Scene/Game Views
  • Modular Windows & Layouts Unity Panels
  • Project (& Asset Folder)
  • Inspector
  • Hierarchy
  • Console

What is a Scene?

We sometimes think of scenes as "levels" or "worlds" depending on the type of game we're creating. That said scenes's can do a lot more!

[!note]+ What can I do with Scenes? Sometimes you might want to display multiple scenes at the same time, with a scene for your UI and one for the Game World. This is just one example that is a little outside the scope for this course.

[!quote]+ Scenes | Unity Man Scenes are where you work with content in Unity.

They are assets that contain all or part of a game or application. For example, you might build a simple game in a single scene, while for a more complex game, you might use one scene per level, each with its own environments, characters, obstacles, decorations, and UI. You can create any number of scenes in a project.

Learn More

When you create a new project and open it for the first time, Unity opens a sample scene that contains only a Camera
 and a Light.

A scene is a container organized into a hierarchy much like the file system on your computer. So what do we put in that container? Most of the things in that hierarchy (nodes for you CS people) are GameObjects which are the primary objects we work with in Unity.

GameObjects are entities that do nothing on their own, but can be used for just about anything in our game by adding Components to them.

[!quote]+ GameObjects | Unity Man The GameObject is the most important concept in the Unity Editor.

Every object in your game is a GameObject, from characters and collectible items to lights, cameras, and special effects. However, a GameObject can’t do anything on its own; you need to give it properties before it can become a character, an environment, or a special effect.

Learn more


Making Our First 3D GameObject

  • Using a mouse to navigate 3D space
  • Selecting & Transforming GameObjects Tip: F to focus!
  • Make a sphere
    • Can learner identify the components on the GameObject?
    • Can learner confidently remove components? What happens?
  • Rename your GameObject to make it more user friendly.

Toolbar

  • Move Tool

  • Rotate Tool

  • Scale Tool

  • Center vs Pivot Orientations

  • Local vs Global Positioning

(Trainers may want to know more for troubleshooting. e.g. What happens if they check maximize on play? What happens if they turn off gizmos in the scene view? etc...)


Cameras

  • Projection is happening... so yeah!

  • Find the "Main Camera" -> Explain relationship between "Main Camera" and Game View -> Position Camera

  • Play with Field of View

  • Play with Clipping Plane (<- What happens if a planet spins behind it)

  • Play with Size

Tip:

  • GameObject > Align View With Selected

Bonus: Add an Orthographic Camera

  • Add new camera
  • Set camera to orthographic mode
  • Use "Depth" to swap between cameras
  • Use "Viewport Rect" to display overtop of the other camera
  • What does "Clear Flags" do?

Adding Materials

  • Method 1: Drag and drop -> Creates material & applied texture -> Applies it directly to the object
  • Method 2: Plus symbol -> Set up from scratch -> Apply texture to albedo symbol

(Point for trainers to make note of: multiple methods to accomplish the same thing in Unity)

  • What happens if we draw on the texture used in the material?

Skybox Material (6 Sided)

  • Create a new skybox -> Add > Material -> Change Shader to Skybox -> 6 Sided
  • Apply skybox -> Navigate to Window > Rendering > Lighting > Enviornment -> Drag & Drop

Lighting

Discussion

  • Compare lights to out GameObjects? What components are on our starting light?
  • Move the light <- draw attention to how it lights GameObjects
  • Try and add a couple different lights (point, directional, spotlight, area) play with the settings

Bonus Challenge: How can we light the sun?

  • Method 1: emission on the sun material
  • Method 2: add light to the sun object
    • point probably best
    • could be separate object or component

Behaviors/Scripts

  • Take a quick peak and open up script. What does it look like on file?

  • Drag & Drop on Earth

  • Apply the sun GameObject to Target field on the component

  • Play with the speed

  • Try again, this time applying a second of the same component to the Earth, also applying the earth as the target

Rotate the moon

  • Method 1: Apply the rotate around script for the moon
  • Method 2: Parent child nesting

Customize & Wrap Up!

  • Play with spawner script
  • Add more planets
  • Try adding some additional components

Bonus Time? Talk Prefabs

  • Create a new GameObject to be a Comet
  • Add projectile script to this Comet
  • Make Prefabs folder
  • Drag & drop comet object into folder
  • Add lots of comets into the scene!

Acknowledgements

  • This course is loosely based on the 1st module from the Game Design & Development course offered at Michigan State University, on Coursera.
  • Thanks to Kitty, Gabby, (put names here) for helping create this tutorial

Resources

Solar System Demo

Learning Unity

  • Hotkeys (note: we could probably make a nicer beginner one) Oxmond makes nice shortcut guides
  • Editor Quick Reference - MSU (see references folder)
  • Unity Man Pages

Other Tutorials (ask prof. McDonald)

  1. Brackeys: https://www.youtube.com/watch?v=IlKaB1etrik
  2. GMTK: https://www.youtube.com/watch?v=XtQMytORBmM

Next Steps