GameCamp! and Game Davis Introduction to Scripting in Unity®

Slides:



Advertisements
Similar presentations
SE 320 – Introduction to Game Development Lecture 5: Programming in Unity & Developing Simple Games Lecturer: Gazihan Alankuş Please look at the last two.
Advertisements

SE 313 – Computer Graphics Lecture 13: Lighting and Materials Practice Lecturer: Gazihan Alankuş 1.
GameCamp! and Game Davis Introduction to Unity®
GameCamp! and Game Davis Creating a 2D Platformer in Unity.
Yingcai Xiao Game Development with Unity3D Inside/Outside Unity3D.
HELLO WORLD: YOUR FIRST PROGRAM CHAPTER Topics  Hello World?  Creating a Unity Project –The Unity Project Folder  MonoDevelop: Unity's Code Editor.
Based on Roll-a-ball video tutorial from Unity Technologies Part WakeUpAndCode.com.
SE 320 – Introduction to Game Development Lecture 11: Animations and GoKit Lecturer: Gazihan Alankuş Please look at the last slides for assignments (marked.
SE 350 – Programming Games Lecture 6: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
UFCEKU-20-3Web Games Programming Unity 3D Basic Concepts Using and Creating Prefabs.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
SE 350 – Programming Games Lecture 1: Introduction Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with TODO) 2/10/20121.
SE 350 – Programming Games Lecture 7: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
Web Games Programming An Introduction to Unity 3D.
Web Games Programming Unity Scripting Fundamentals.
UFCFS D Technologies for the Web Unity 3D: Review of Topics and Related Concepts.
Unity 5 Visual Studio Code * Asset Store * FPS * Terrain.
Learning Unity. Getting Unity
SE 320 – Introduction to Game Development Lecture 3: Unity’s Interface and Concepts Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
SE 320 – Introduction to Game Development Lecture 7: Programming Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with.
Yingcai Xiao Game Development with Unity3D. Outline IDE Engine Assets Tutorial Examples Inside.
UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web.
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
CLASSES CHAPTER Topics  Understanding Classes –The Anatomy of a Class  Class Inheritance –Superclasses and Subclasses –Virtual and Override 2.
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
SE 350 – Programming Games Lecture 5: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
UFCEKU-20-3Web Games Programming Instantiating World Objects.
Yingcai Xiao Event-driven Programming in Game Development Yingcai Xiao.
UFCFSU-30-13D Technologies for the Web An Introduction to Unity 3D.
Expressive Intelligence Studio // Center for Games and Playable Media // Unity Pro John Murray Expressive.
Cosc 5/4735 Unity 3D Getting Started Guide for Android.
INTRO TO UNITY Building your first 3D game. DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies.
Yingcai Xiao Game Development with Unity3D Inside/Outside Unity3D.
Angry Teapots– using the physics engine in Unity Peter Passmore.
Building Games for the Humanities with Unity3D Rudy McDaniel University of Central Florida Orlando, FL USA.
Game Development with Unity3D
Welcome! Day1, Lesson 1.
Thanks to our Sponsors! Community Sponsor Yearly Sponsor
EEC-693/793 Applied Computer Vision with Depth Cameras
Quick Intro to Unity Lecture 2.
Game Development with Unity3D Inside/Outside Unity3D
First Person Shooter Project
Building a Game with Unity3D
3GB3 Game Design Unity 3D Basics.
More (C#) Scripting Day 2, Lesson 1.
Unity 2D: Step by Step, Part 4
EEC-693/793 Applied Computer Vision with Depth Cameras
Character Selection from a lobby in Unity
EEC-693/793 Applied Computer Vision with Depth Cameras
Unity 2D: Step by Step, Part 2
lecture 8 Our First Project
lecture 7 Our First Project
Create a Simple UI Game in 10 Steps
A beginner’s tutorial for Unity and VR
Prepared by: Engr . Syed Atir Iftikhar
Building a Game with Unity3D
Week 6: Time and triggers!
lecture 9 Our First Project
Myo + Oculus Rift Tutorial
Unity Terrain Design Tutorial
Fundaments of Game Design
Fundaments of Game Design
EEC-693/793 Applied Computer Vision with Depth Cameras
Unity Game Development
Cosc 5/4735 Unity and Cardboard VR.
Unity Game Development
Unity Game Development
A Gentle Introduction to Unity 2D Game Programming
Presentation transcript:

GameCamp! and Game Davis Introduction to Scripting in Unity®

Create Standard 3D Project

Unity® Interface

Create Cube ▼Create ►3D Object ►Cube

Add a Script Component Name: ColorChanger public Color color; Void Start { GetComponent ().material.color = color; }

Test See that while the cube is white in the scene view, when the game runs, the cube changes to the assigned color

Add Another Script Component Name: Mover public Vector3 movementVector = Vector3.right; Void Update { transform.position += movementVector * Time.deltaTime; }

Test Notice that the cube only moves to the right indefinitely

Add More Code to Mover private Vector3 startPosition; Void Start { startPosition = transform.position; }

Add More Code to Mover After transform.position in update if (transform.position.x > startPosition.x + 1) movementVector = Vector3.left; else if (transform.position.x < startPosition.x – 1) movementVector = Vector3.right;

Test Now the cube should move back and forth when the game is run

Make the Scripts Interact Make changes to ColorChanger public Color color1; public Color color2;

Make the Scripts Interact Revise the Start code: Delete: GetComponent ().material.color = color;

Make the Scripts Interact void Update () { if (GetComponent ().movementVector == Vector3.left) GetComponent ().material.color = color1; else Getcomponent ().material.color = color2; }

Test The cube should move back and forth and also change colors when changing directions

Create Prefab Rename Cube in Hierarchy to SpecialCube Drag SpecialCube into Assets Create 2 more of these SpecialCubes from the prefab in Assets – drag from Assets into Hierarchy or Scene

Test All the cubes are identical in behavior

Individualize Cubes Change colors and movement vectors (X only) in the Inspector Bold means values are set to different parameters than the initial prefab Default values set when making the prefab

Test The cubes should behave differently

Ball Rolling Tower Destroyer Create a New 3D Project Create: Terrain Cube, add RigidBody component Sphere, add RigidBody component

Ball Rolling Tower Destroyer Make sure cube and sphere are above terrain Cube and sphere Ys should be set to.5 or higher Use ‘W’ to show translation arrows

Ball Rolling Tower Destroyer Add new script BallMover to sphere

Ball Rolling Tower Destroyer Add SmoothFollow script from Imported Characters Assets – search in “Add Component” Add as component to Camera, then assign follow target as sphere

Test Roll ball around and knock the cube

Duplicate cube Make 5 levels of 3x3 using CTRL+D (duplicate) and holding CTRL when repositioning (snap 1 unit of distance)

Test Try destroying the tower… probably much harder to do

Adjust Mass of Sphere In RigidBody component to 10

Test Sphere moves slower, since it is heavier, but is more effective

Adjust Mass of Cubes Group select all cubes (using CTRL or CMD) Change mass to.15

Test Knock over everything!