Unity 3D Crash Course
Unity 3D Crash Course
CRASH
COURSE
TUTORIAL
Author: Kevin Hoang
(Quoc Anh Hoang)
INTRO
Welcome everyone to the tutorial section of the
Unity 3D Crash Course.
Yippee!
ANNOTATION:
RED ==> MEANS ALERT U NEED TO READ
YELLOW ==> CHALLENGE
GREEN ==> NEW KNOWLEDGE / FACT
I. SETUP
First thing first, let’s install Unity into our computer, the version that we are going to be using for
this tutorial will be the 2022.3.51 version , but you can use Unity 6 if you want to however for
stability I would highly recommend that version, you can find the version through Unity Archive
and install it by pressing the blue install button, after that it should take you to Unity hub for
installation, if you haven’t install Unity hub, you should install it before downloading the editor,
you will find both of the URL for editor and the hub down below
Don’t worry about those security alert ! , It would be alarming if you planning to release a game in
the market, and if you do, I would recommend installing version 2022.3.62 or later
Once you finished installing the engine, let’s fire up that puppy and start building juicy prototype
Let’s create our new project and name it “ PaintBallPrototype_[your name] “
AND REMEMBER TO CHOOSE 3D CORE
After that, once you are happy with the setup, go ahead and press the create project button
Once Unity finished crreating project for you, you should see the editor screen like this,
hmpmmmmm fresh 3D air
HOLD UP BEFORE WE ARE GOING TO BE CREATING ANYYYYTHING, we need to setup our folder
structure for best practice and easier to navigate whenever we import any new assets into our
project, your folder setup should be
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
With this kind of folder structure, whenever we import a new assets, the new imported asset
folder going to be hanging around outside and if we ever open the project and need to find all our
files that relate to our project, we just need to find the root folder of our project which should be
named “_PROJECT” which would cost less time than scramming around those assets folder mixing
with your own project folder finding your own thing
the “_” slash thing would trick the computer naming priority, so that we would always see our
_PROJECT folder on top
For demonstration , taking an example if I ever import a zombie model assets, It my folder
structure will be like this
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
ZombieModelPack
So Pleaseeeeee stick with this project folder structure, it will benefit you in many ways in the
future
After finishing setting up the folder structure, create a new scene a name it Game
Once you open the new game scene that we just created, we shall start building our game
Now, let’s start our project by setting up our level, first let’s make a ground by
Right click on the mouse => Choose 3D object => Choose plane
Now you will see a flat plane be created on your scene, select the plane object on your Hierachy
tab which is on your left, then on the inspector tab which is on your right, you should see all the
components that the object holds and properties information in each components
The only component that we currently being interest at the moment is the transform component
since we are going to be scaling it so we can have a bigger floor, I personally will be scaling it at the
value (x: 1.5 | y: 1 | z: 1.5), we left y remain as is it since the plane ignore the y value and has no
meaning when changing it
Other way than changing value directly on properties you can also change the scale of an obejct by
Select the object you want to scale => Press “R” key on your keyboard to enter to scale mode
And you should see these knob that you can pull it out on each axis
BUT BEWARE, whenever you scaling/positioning/rotating ANY OBJECT IN 3D SPACE MANUALLY,
IT IS HIGHLY RECOMMEND HOLD CONTROL KEY WHILE DOING IT in most cases so that the object
can snap into desired position/rotation/scale to be having a round value such as (1.5) instead of
(1.5845738958)
After that we going to be setting position properties of transform component of the plane to be all
at 0 (x: 0 | y: 0 | z: 0) so that it will help on our journey later on in this tutorial and usually when
developing a game, developer would usually place their own level at center of the space to advoid
floating point precision which is the further the (x: 0 | y: 0 | z: 0) these value get the less precision
these number have, you can google this information to take a better in depth research about this if
you want to but for now your ground should be like this
After we finished setting up our ground, we should be add some wall to our testing ground and we
Right click on mouse => Choose 3D Object => Cube (since we are building walls)
After that, you should see a cube spawning into your scene
And for the wall, I will leave the properties of scaling be at (x: 1 | y: 6 | z: 10 ) since I want a thiccc
wall in my testing area so player can’t leave my playground muwahaha
Now to make more space for the ground, we will move the wall to the edge of the floor, to do that
there will be two options
OPTION 1:
Like I have said at creating ground part, you could and YOU SHOULD hold control key then move
the wall to the edge of the ground manually with the arrow while in the move tool mode
OPTION 2:
If you are OCD like me and want the wall 100% fit at the edge of the floor, you could:
Select an object you want to move => Hold “v” key to get into vertex snapping mode => then hover
to the corner of the selected object, once you got it, just drag it around to your desired position
Then WOLLA
Then repeat the process until you finally reach the result like this
Once you finished, nice ! You just build your own first little prison for testing our game mechanic
but before we move onto coding and fun stuff, you should put all our wall and floor into a parent
object and name it “ Level”
so that we could have a cleaner Hierachy and it also for best practice because in the future when
you have a huge level, you don’t want to spend hours just to find an item that does not relate to
level design, so guys please please please have a clean Hierachy please so you can navigate
everything easier
FIRST OPTION:
Right click => Select “create empty game object” to represent our level parent => then drag all our
object related to level into that parent
SECOND OPTION:
You can highlight all of the object related to level => Right click => Create empty parent
But I would recommend first option since you can move the empty object to be at the desired
position to represent the center of all those child objects
II. CHARACTER
GREATTT JOB you have finished making a prison for our player, now the fun part, making the player
and COOOOODING
First thing first, let’s give our player a body in the game by
Right click on the mouse => 3D Object => Capsule
Fun fact: 3D modelers / level designer/ game prototypes frequently use capsule shapes as a basic
reference for characters because they offer a simple, effective starting point for establishing
proportion of a character before committing to a more detailed model
After the capsule spawn into the scene, we should center it to the level (for now) and rename it as
“Player”
After we got our capsule player, let’s add camera to our player
Since we already have the main camera in our scene, you can go a head and use that one if you like
it or you can create one if you don’t have it or accidentally delete it by
Once you got camera in your scene, we will make it as a child of our player representing
character’s head and camera for our player can look around in first person view
Now we got everything setup, let’s move onto the JUICY PART COOOODIIINNG our player
movement
so locate to your script folder, create a new folder and name it “player” .
Lately I’ve been seeing some of student putting their script into one folder DO NOT DO THAT again
you don’t want to spend 2 – 10 minutes of your own life just to find a script in a folder fill with 20
other scripts, and things would get harder if you are doing big project SOOO PLEASEEE HAVE A
CLEAN FOLDER STRUCTUER
After creating new folder, your folder structure should be looking like this
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
|_Player
After all of that done, create a new script and name it PlayerCamera
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
|_Player
|_PlayerCamera.cs
After that, let’s fire up our script and let’s startttt coooooooding
First thing first, before we can move our player, we will need to make our player be able to move
around their own head.
But wait, if you are willing to take on this challenge by your self, I will leave this mechanic loop
down here and you test your own limit to see if you can code it without my guide (would
recommend it)
Now here’s the guidance
First off, let’s declare 3 variables
Remember for best practice you SHOULD NOT write your logic directly into Update() or Start()
because in the future when you work on big project and if you do not separate your logic into
different functions, it could lead to thousands of messy spaghetti lines of code
After that, let’s write our mouse logic, first we will need to get our mouse positions on the x and y
axis then convert the raw mouse movement into a useable value for the rotation
local varible is a varible that only exist within a function, once the function finished their own
execution, it will automatically erase the existance of all local varible in that function
Once it been declared, we will get the axis of our mouse position y using [Link](“Mouse X”)
Some of you might be wondering, what is “Mouse X”, “Mouse X” is a predefined input axis in Unity
control table that represents horizontal mouse movement
Now at this point you might think, we already got information of mouse axis, so we can start
calculating our rotation then apply it to rotation of the camera
BUT NOOOO NO NO NO , because of the input we got was a raw input which only return between
(-1, 0 and 1) for x and y axis which is up down and left right, because of that we need to multiply it
with [Link] to convert into a smaller value so that our camera would rotate smoothly
instead of snappy with the raw value
[Link] time Is a property that holds the time elapsed in seconds since the completion of the
last frame
Some of us might prefer a fast rotation of camera, some of us prefer slow, because of that we need
to multiply with the mouse sensitivity, so that the mouse speed can be at desired speed that player
want to
After that, we do the same for the y axis to track the y position of the mouse
[[ END]]
After we got ourself both axis of the mouse position, is time to apply those value into the
calculation and take those calculation then implement it into our camera rotation
private void MouseMovement()
{
float _mouseX = [Link]("Mouse X") * mouseSensitivity * [Link];
float _mouseY = [Link]("Mouse Y") * mouseSensitivity * [Link];
_currentXRotation -= _mouseY;
_currentXRotation = [Link](_currentXRotation,-90,90);
}
[[ So WTF is happening here you might ask ? Well let me break it down to ya ]]
After we got x and y position of the mouse, we will need to re calculate it for the camera rotation
_currentXRotation -= _mouseY;
In this line we are subtracting between (current x rotation value with the mouse Y position value)
because Unity’s rotation direction and mouse input direction are opposite.
[Link] is a restriction function that the targeted value only be able to fall into between a
given range of min and max value
[Link]([targeted value], [minimum value], [maximum value])
[[ END]]
After all of those part, we finally be able to implement those calculated value into our camera
rotation, to do this, we can use [Link] to rotate our camera to the position that our
mouse move to
_currentXRotation -= _mouseY;
_currentXRotation = [Link](_currentXRotation,-90,90);
[Link] = [Link](_currentXRotation,0,0);
[Link]([Link] * _mouseX);
}
[[ So WTF is happening here you might ask ? Well let me break it down to ya ]]
[Link] = [Link](_currentXRotation,0,0);
In this line, we just simply setting the local rotation to be rotating camera on the x axis with the
given value from _currentXRotation and keep y rotation and z rotation the same , so that the
rotation only affect on the x rotation, others axis has no affection from it
But why use LocalRotation ? Why not Rotation ? The world rotation, good question if you
wondering, the reason we use local is because the camera currently being the child of our player
character and we want the camera to be respecting the parent of itself by rotating relatively with
the player body so if
Only the body will rotate on the x axis, the camera won’t be rotating at the same axis with the
character body it will ignore the parent and only respecting the world itslef
[Link]([Link] * _mouseX);
On this line, we just simply telling our character body to rotate around the Y axis ( left and right )
base on the mouse X axis positioning
[[ END]]
After that, you can go out side
• Attach script into our camera
• Set value of mouse sensitivity
• Drag our player body into our script
Now you might think, WHYYY THE CURSOR IS ON THE SCREEN I NEED IT TO DISSAPEAR LIKE ANY
OTHER GAME, you can simply modify the cursor to be disappear on start in the code with the
following line, remember to put it into MouseInitializer() which is function going to be call in Start()
THEN WOLLA CONGRATSSS YOU JUST FINISHED THE PLAYER CAMERA MOVEMENT now you can
look around the BEAUUUUUTY of 3D world and sniff around the fresh 3D air
Now enough with the admiration of 3D space, we are still not be able to move around so let’s add
that into our character so that we could move them using wasd
First thing first, before we can move onto coding, go a head and add “character controller”
component into our “Player” game object
Character Controller is a component in Unity used to provide direct, script-based control over
character movement and collision without relying on the full complexities of the physics engine
After that, let’s create another script and call it “PlayerController” in our script folder, remember
PUT IT INTO OUR SCRIPT → PLAYER FOLDER so it should be looking like this
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
|_Player
|_PlayerCamera.cs
|_PlayerController.cs
After the script have been created, let’s open it and code the moving functionality for our
character
But wait, if you are willing to take on this challenge by your self, I will leave this mechanic loop
down here and you test your own limit to see if you can code it without my guide (would
recommend it)
}
}
After that we can start writing our own logic, before we can move our player we will need to get
axis on our keyboard
[[ So WTF is happening here you might ask ? Well let me break it down to ya ]]
float _x = [Link]("Horizontal");
In this line, we only getting raw axis from the input so basically in the horizontal axis:
float _z = [Link]("Vertical");
same with this line, we only getting raw axis from the input so basically in the vertical axis:
For demonstration you can check out the image below and see how the axis going to be using for
our character movement
[[ END ]]
After we got all those axis done we will need to calculate it so It can apply it on the current position
of the character and tell the character move to the next position that player desired start from the
current location that they are standing at
After we got all of our position axis and store it into our varibles which are _x and _z
float _x = [Link]("Horizontal");
float _z = [Link]("Vertical");
we will need to calculate the next direction for the character to move to base on where are they
standing
[Link] => is the player’s current local direction on the right and it change when the
player rotate
[Link] => is the player current direction that they are facing at
Combine with the value of our input direction, we will be able to make the player go forward at the
direction that they are looking at and shift to right and left at the position that they are heading to
at the same time
And for the final touch, we will tell the charactercontroller where to move using function Move()
by:
• giving our vector 3 direction which is _move
• multiply with playerSpeed so the player can move faster
• multiply with [Link] to make movement and other time based actions frame
rate independent
If you wondering how can vector 3 (_move) be able to multiply with float values (playerSpeed /
[Link]), well here how it works
But wait, if you are willing to take on this challenge by your self, I will leave this mechanic loop
down here and you test your own limit to see if you can code it without my guide (would
recommend it)
Now here is the full guidance
First thing first let’s create a new folder in our script folder and call it “weapon” , after that
create a script and name it “GunBehaviour”
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
|_Player
|_weapon
|_GunBehaviour.cs
But before we can move onto coding, we will need AN ACTUAL GUN (3D model of course please
don’t try to buy a real gun), you can go a head to the unity asset store, there are tons of free 3D
model gun up there, once you find the one that you like the most, download it and import it into
our project
The one I’m going to be using today is the 1911 beretta , you can find it through this link if you like
it => [Link]
After that, click to “Add to My Assets” button and let’s move to unity
In Unity, yo will need to open the package manager to be able install it into your project, and you
can open the package manager tab by locating to top bar, Windows => Package Manager
Once yo pressed it, it shold show up a package manager window like this
Before yo can search the package yo just pick up from store, you WILL NEED to change package
type from unity registry => my assets so the package manager can fetch all of the current assets
that you own
After that you can go a head navigate to the search bar and type in the package that you just got
Once you locate the package, go a head and press the download button then import button
Once you pressed import button, it will show up the window like this
This window just a preview for us to show the item that they going to be importing into our game
and usually developer would ignore the preview and straight ahead press import because we don’t
want to cause any errors after the import
Now with the folder structure we can already see our advantages
After the import the asset folder will be separate from our project folder meaning that we can
navigate our project related files easier with this kind of structure and we don’t have to scramble
around for many hours just to find our wanted file
In the asset file we now want to go a head and look for the prefab folder which contain the gun
model that been filled enough information of the material for the model
After located the prefab, go a head and drag the gun into our scene
After the gun is in the scene, go ahead and change it position to be at the camera like you are
holding a gun
After that once you hit play and move around then UH OH, the gun does not move with you
I guess some of you might already guess why, the reason because of this is that we need to parent
the gun to our camera (not the player body) so that the position of the gun can be relate with the
player whenever the player move to different location and relate with the rotation of the camera
when the camera rotate to a different angle so go ahead and parent the gun to the camera then
WOLLA you have yourself a character holding POWER OF THE AMERICA RAWWWWRAAA
After we got the gun at the position we like, now we can start COOOODING for our AMERICA
POWER RAWWRAA, so open up the [Link] script and let’s start coding
First thing first, let’s declare some variables before we could start anything else
We will need
• An int to set our ammo limitation and also tracking our current ammo
• A Float to represent how much force we are going to be adding into our physic bullet
• A Transform type to store the gun’s barrel position
• A Rigibody to store the gun’s bullet prefab with physic so we can addforce into it
• An int (you can set this private since we don’t modify it in inspector) to store default ammo
amount
And as always for best practice two functions for our Start() and Update()
void Start()
{
GunInitializer();
}
void Update()
{
GunInput();
}
First thing first, we will need to store the ammo that have been assign to the gun into
_defaultammo varible so that whenever the gun ammo reaches to 0 (ammo = 0) the gun will have
a varible to remember that “AH this gun has 10 ammo which been storage in the _defaultAmmo
varible”
Because of that it just need to go a head and grab the value from _defaultAmmo and reset the
amount of ammo again base on the value from the _defaultAmmo varible
_spawnedBullet.AddRelativeForce([Link]*bulletSpeed);
ammo--;
}
}
}
[[ So WTF is happening here you might ask ? Well let me break it down to ya ]]
if([Link](0))
So first thing first before we could shoot our gun, we will need to check for our player input
whether they pressed down the left mouse button with if([Link](0))
Once the [Link](0) returns to true we shall perform the shooting logic for
the player.
if(ammo > 0)
{
Rigidbody _spawnedBullet =
Instantiate(bulletPrefab,[Link],[Link]);
_spawnedBullet.AddRelativeForce([Link]*bulletSpeed);
ammo--;
}
Before we can fire our gun, we will need to check whether our gun still have enough ammo through this line
if(ammo > 0)
If there is still ammo left, we will spawn the prefab and store it into a local varible through this line
Rigidbody _spawnedBullet = Instantiate(bulletPrefab,[Link],[Link]);
And the reason we are spawning and storing it is because we want the object the just spawn it out
not the prefab itself so we can add some force into the bullet just spawn into scene later on
After the spawning we will add force to the bullet that we just spawned out using the local variable
that we used to store the spawned prefab (_spawnedBullet) and Rigibody function called
Addrelativeforce()
_spawnedBullet.AddRelativeForce();
In the Addrelativeforce() it requires 1 arguments which is the direction where the bullet going to
be heading to which is the forward of the gun barrel by using Transform function which is
[Link] in our case it would be => [Link] since gun barrel is transform
type
_spawnedBullet.AddRelativeForce([Link]);
And to be able to change speed or how much force should we give to the bullet, we will need to
multiply the direction with the speed of the bullet to give some push so that it would look like the
bullet flew out from the gun
_spawnedBullet.AddRelativeForce([Link]*bulletSpeed);
After that we will need to decrease the amount of ammo that we currently have by simply
ammo--;
[[ END ]]
Now we are almost there, but before you can fire your own gun we will need to create a physic
bullet for our gun, so go a head and RMB => 3D Objects and Sphere
Once you created the Sphere, scale it down to tiny weenee little thang but not too tiny though to
create a bullet I will leave it as 0.1 in scale you can leave smaller if that works for you
After the adjustment, here is the main part for the bullet, in the inspector pannel WHILE BULLET
BEING SELECTED, drag all the way down until you find add component button then search for
Rigibody, after that add the Rigibody component to our bullet to enable physic of our gameobject
Once that done, go ahead and rename the gameobject to bullet then make the bullet as prefab so
that we can spawn bullet through our gun
In Unity, a Prefab is a reusable template for a GameObject (like an enemy, item, or building part,
etc) that stores its components, properties, and hierarchy, allowing developers to create many
identical instances easily and update them all at once by modifying the original asset in the Project
window
Once we already have our bullet prefab you can go a head and delete the bullet in the scene
And nowww for the finalll touch, go to your gun and add the gun script into it (you can also add it
by searching the name of the script in add component button rather than dragging it)
Fill in all your information, drag your bullet prefab into your script and then you can start using the
POWER OF AMERICA RAWWWWRAAA
CONGRATS CONGRATS YOU JUST MAKE YOUR FIRST GUN YIPPPIEEE RAWWWRAA
IV. BLOCK
Congrats on making to the final section of the tutorial yayyyy, in this part we are going to be doing
interesting before coding
I’m tiered of using Unity boxes and searching model from assets store it kinda limited though, so
let’s add in our custom 3D gameobject using website => [Link] a heaven for 3D
models, there’s also other websites like turbosquid or artstation but for now we will stick with
sketchfab so sign up and let’s start browsing for our model
For this tutorial I’m gonna be using crate box model which is highly suitable for our prototype, you
can get it here if you want to =>
[Link]
or you can use your own model that you find if you want to
If you look closely there will be information for the amount about the triangles and verticals, you
might wonder what is it ?
In 3D model there are loads of vertices connecting to each others creating triangles but what are
they actually ?
Looking into this humanoid wireframe model,the vertical are the straight line you can see on
screen
And the purpose of those lines act as the connection between other line creating into a shape, a
triangle shape to be specific to create a face of a model
So the higher the amount of tris and verts the slower the cpu will handle since it will have to
calculate more geometry of a model to create into a shape
(For those wondering, yes cpu not gpu, cpu and gpu does work together to generate model but
generally is the cpu do calculation for the model geometry and gpu calculate things that related to
graphics like lights, texture, shader)
After that once you are happy with the model that you choose, click own the download 3D model
button and select the .fbx format (if you don’t have .fbx choose .obj if don’t have both just choose
the top format)
And the reason we choosing .fbx is because .fbx holds data of animation, model, texture, even
scenes between different 3D software and game engines, because of that .fbx is kinda popular in
game development since it can hold many data
Once you downloaded it, extract it to a folder with the name of the model your downloaded
After that IN UNITY, make a new file in the _PROJECT folder and call it as “3D Model”
Then drag your model file into it
_PROJECT
|__ Scene
|__ Prefabs
|__ Scripts
|__ 3D Model
After the import have finished locate the model file (.fbx), usually it will be in a folder called
“source” after that drag the model into our scene
And congratsss you just have your first custom model imported and exist in your unity project
Well in 3D, a material defines the visual surface properties of an object, controlling how it looks by
dictating its color, shininess, transparency, reflectivity, and texture, essentially mimicking real world
substances like metal, wood, or glass to create realistic or stylized appearances , overall it define
the visual of a model
To create a material for our box, go a head to our project pannel and RMB => Material and name it
Box Mat
After that, select to the material you just created, that grey sphere icon, then on the inspector
pannel,you should be seeing all of the information that you can fill in for your material to define
the visual of your box
There tons of information here but for now let’s focus on the main map
So what is the main map and wtf are those properties inside it you might ask ? The main Maps
control how a material looks under light. They define the surface color, shininess, roughness, and
surface detail.
Albedo
The Albedo represent the base color of the material, it can also be the texture or both at the same
time
So whenever you need your model to display the main texture for it, Albedo is where the
information of the texture should be at
Metalic
Metalic control how metal like the surface is and it will be from range 0 to 1
Other than the value slider, there’s also a metalic map to define which part of the model to be
metalic or a little bit of metalic depending on how white it is
Smoothness
This part will control how shiny or rough the surface of model is
Normal Map
A texture that represent fake surface details without adding any more geometry directly to the
model
Height map
Creating illusion of depth using light and shadow through the height map texture
Occlusion
Darkness areas where light is hard to reach, the map will create an area on the image and when it
apply to the texture, the computer will know which area has more shadow which area has less
shadow
With all those information, I guess some of you know what to put in our material
Back to our material, in the model folder you will see there’s a folder call textures, that’s is the
mapping texture for us to fill in our material
With all given map go ahead and fill in those maps into our material
Once you have finished, with the box model already existed in the scene DRAG THE MATERIAL
FROM PREFAB TO THE MODEL IN THE SCENE then release it then WOLLA you got yourself a
wooden crate
Now let’s begin the fun part of the tutorial COOOODING
So create a folder in your folder script and call it “Object” then create a script in there and call it
“BoxBehaviour”
Once that done let’s open up our script and create a target that we can shoot
In this one there will be only one varible which is an int to represent box health
Awsome, now once you have it let’s write logic for our box
if(boxHealth < 2 )
{
[Link]<MeshRenderer>().[Link] = [Link];
}
if(boxHealth < 1)
{
Destroy([Link]);
}
}
[[ So WTF is happening here you might ask ? Well let me break it down to ya ]]
In Unity there’s a built in function for whenever there are 2 objects that collide with each other
and the function is OnCollisionEnter(Collision collision) In this line we are detecting
whether 2 objects have been collided and if they do
We will check other object tag has the tag that we are requiring which is “Bullet” through this line
if([Link]("Bullet"))
After that If it has the same tag, we will run the function BoxBehaviourCheck();
if(boxHealth < 2)
{
[Link]<MeshRenderer>().[Link] = [Link];
}
if(boxHealth < 1)
{
Destroy([Link]);
}
}
In this function that we made is fairly simple we are just decreasing the box health of itself
boxHealth--;
[[ END ]]
After that, you can go back to unity, add collision to your crate and your script, set the health for
the create thennnn hit play
Buuuuttt something is wrong, the crate is not doing any thing eventhough the bullet touches the
care what is going on ???
Is because that you haven’t set the correct tag for our bullet, since our crate behaviour detect
collision using tag
We will need to add the correct tag into our bullet, so go a head back to our bullet prefab and add
Bullet tag to our bullet
Hmmmmph is seems that there aren’t any bullet tag here, because of it we can create one by
hitting add tag then it will bring you up to windows like this
Once you there, you can add new tag by selecting plus icon “+” then enter your new tag, hit save
and come back to bullet prefab now you shall see your new tag, and beware of upper case and
lowercase letter, the tag system will check every single letter
Now hit play and you shall have THE POWER OF AMERICA RAWWWARRAAAAA and the box will
also turn red when the health below 2
Stack it up 3x3 then add rigibody for each box anddd WOLLA we have simple box shooting physic
game YIPPPPIEEEEE
CONGRATSSSSSS YOU JUST
FINISHED ALL OF THE
ASSIGNMENT BUTTT WAIIT
SCROLL DOWN I HAVE SUPPRISE
UNITY CHALLENGE
this is the place where the challenge I give for you guys
will be test and will be break to level up your skills
So with the current game we already created I will give you guys task with NO HINT NO SYSTEM
ARCHITECTURE IMAGES, you guys will have to use your incredible mind to create your own system
and for your own goods, remember NOOOOOOOOOOOOOOO AI I WANT ALL THOSE TABS OF
CHATGPT CLOSED INSTEAD I NEED IT TO BE FLOODED WITH UNITY FORUMS, STACK OVERFLOW,
UNITY DOCUMENTS, YOUTUBE, OR WHATEVER THE RESOURCES THAT YOU CAN FIND ONLINE TO
HELP YOU USEEE UR MINDD
3. With the current behaviour of the box, change to color yellow when the box
health below 3
4. With the Audio source component add sound for the gun when it fires and
add sound for the crate when the bullet hits
Unity Doc:
[Link]
[Link]
5. Make a count down system when it hits 0 the player loose the game and
when player hit all the boxes the player win the game and remember to display
it ON SCREEN
6. (Optional but suggest) Research on what is particle system and add the
particle system effect when the gun is fire and when the crate got hit