andriajah Sat Oct 2021 1 year ago

Make Your First Complete Game In Unity | Beginners

EXPAND FOR TIMESTAMPS - I make a breakout clone game and the entire process in real-time from start to finish. Including prototyping core mechanic, transitioning between game states, loading levels, spawning objects, cleaning up, keeping score, handling menu screen transitions, and high scores. This video is for beginners that want to learn about Unity and how to take the step to move from a game mechanic prototype and turning it into a "re-playable" game with menus.

Project Download: https://www.dropbox.com/s/qpk15rgs192s3o4/Imphenzia-SimpleBreakoutClone.zip?dl=0

Timestamp Shortcuts:
00:00 Intro
02:55 Starting in Unity
03:00 Organizing Folders in Project
03:30 Creating the First Game Object - the ball
04:45 Changing perspective to orthographic camera
07:00 Creating your First Script - ball physics movement
07:35 Defining your First Variable
08:45 Accessing a Rigidbody from a script
09:15 Setting the ball's initial velocity
10:00 Bounce the ball in OnCollisionEnter()
10:15 Reflecting a Vector3 to bounce the ball properly
11:30 Importance of the FixedUpdate() function
11:55 Forcing velocity of the ball to a constant speed
12:40 Keeping ball velocity consistent after impact
13:15 Adding walls and ceiling to play arena
13:40 Using control key to snap movement in Unity
15:05 Freezing the axis of the ball to horizontal/vertical movement only
16:25 Controlling the paddle with mouse
16:45 Freezing paddle movement to left / right only
17:45 Correct way to force repositioning of a Rigidbody to from a script
18:10 Translating mouse movement (screenspace) to world space with ScreenToWorldPoint
20:05 Hiding the Mouse Cursor
21:05 Switching the Rigidbody to a Kinematic Object (make it "rock solid" =)
21:45 Creating the Bricks / Blocks
22:50 Creating a PREFAB (Very important - don't know what a prefab is? Check this out)
23:50 Spacing between the bricks / blocks
24:00 Stressing the importance of PREFABs again - demonstrating the use of them
25:10 Exposing a variable in a script as a public variable so it can be changed in the Unity "inspector"
26:00 Are you a fan of big score or small scores??
26:25 Using OnCollisionEnter to reduce the hit counter
27:00 Destroying the brick / block on ball impact
28:00 Creating your first material - coloring the bricks blue
28:30 Adding more bricks to the level, duplicating and positioning bricks
30:20 Adding rotational animation to bricks
32:05 Offsetting the rotation for twisting type of effect of the blocks
33:10 Changing bricks to a metallic reflective look
33:40 Adding a white flash Amiga style "hit flash effect" like the good old side scrolling games
37:00 Using "Invoke" to delay a call to a function - in this case to restore the material after flash
38:10 Moving the bricks into a Level Prefab
38:50 Creating the GAMEMANAGER script - this is controlling the game states and user interfaces!
40:00 Changing the ball and the paddle to prefabs so they can be "Instantiated"
40:45 Creating your first User Interfaces / Menu Screen
41:25 Creating the Main Menu UI panel
41:35 Adding the Play button to the Main Menu
41:55 Scaling the menu to maintain the same size compare to the screen size
42:30 Creating the Play UI panel with score, ball, and level counter
43:00 How to position UI elements - the RectTransform, anchoring point, alignment, and position
45:25 My 5 year old daughter explains what a Breakout Clone is
46:45 Using control . (period) to easily implement "using" statements
47:05 Exposing access to Score Text - Ball Text - and Level Text
47:30 Exposing access to UI panels, Menu - Play - Level Completed - Game Over
48:00 Creating the Level Completed UI Panel
48:50 Creating the Game Over UI Panel
49:20 Hiding unwanted UI Panels
49:30 Creating a State Machine with states Menu, Init, Play, LevelCompleted, LoadLevel, GameOver
49:50 Making it possible to switch states using a SwitchState method
50:45 Ending the CURRENT State and beginning a NEW State
51:45 Ctrl Period to implement all missing cases
52:50 Showing and hiding panels on Begin / End States
54:55 Making the Play button work
57:00 Using Properties to update UI Score / Ball / Level texts
59:15 Adding points to score
1:01:00 Initializing variables
1:02:00 Adding more levels
1:05:40 Instantiating new ball
1:08:00 Game Over when no more levels
1:08:30 Loading New Level
1:09:25 Delaying a State Transition
1:12:40 Switch paddle (for ball direction control) and brick to 3D objects (Blender)
1:22:25 Detecting when ball / life is lost with IsVisible
1:27:00 Editing Levels - Overwriting Prefabs
1:27:30 Ending Level when no blocks remain
1:32:50 Waiting for AnyKey press
1:35:00 Persistent Highscore
1:39:50 Reset Level on Game Over
1:42:00 Scrolling Star Field Background
1:47:00 Unpacking and Overwriting Prefabs
1:52:15 Outro / Ending
1:52:40 On the topic of climate change

https://patreon.com/imphenzia
https://teespring.com/stores/imphenzia
https://www.imphenzia.com
https://twitter.com/imphenzia
unity3d tutorial make a game make a complete game breakout arkanoid making a game in unity how to make a game in unity learn unity state machine game states ui panels highscore prefabs fixedupdate persistent highscore UI buttons invoke delay function OnCollisionEnter score counter loading a level gamemanager game manager mouse movement ScreenToWorldPoint what is a prefab amiga style hit effect white flash updating score complete game in unity unity3d