GAMEPLAY - How to make a Video Game in Unity (E06)
HTML-код
- Опубликовано: 4 мар 2017
- Alright enough messing around... Let's turn this into a game!
● Download the Project Files: devassets.com/assets/how-to-ma...
● Brackeys Forum: forum.brackeys.com/
❤️ Donate: www.paypal.com/donate/?hosted...
····················································································
This video is part of a mini-series on making your first game in Unity.
····················································································
► Join Discord: / discord
♥ Subscribe: bit.ly/1kMekJV
● Website: brackeys.com/
● Facebook: / brackeys
● Twitter: / brackeystweet
····················································································
► All content by Brackeys is 100% free. I believe that education should be available for everyone. Any support is truly appreciated so I can keep on making the content free of charge.
····················································································
♪ Baby Plays Electro Games
teknoaxe.com/cgi-bin/link_code...
If you're are watching this in 2020, the fog setting can be found under Environment, rather than Scene. I hope I can save others the time that I lost trying to figure this out lol.
this needs to be one of top comments
so clutch
Tysm
Thanks A Lot, Saved A Lot Of Time
my man coming in clutch
I just beat my own game... And it was more frustrating than Dark Souls
lmao
Can relate tho
Same Goes With Me . Tho gg on completing your game👏
can you help me because the apply button isn't under inspector and when I change something like at the beginning of the video, only one object is affected
@@pangisang513 It applies automatically I'm pretty sure that's what happened to me
If you need help with the Fog in 2021 its in window > Rendering > Lighting > Environment. Your welcome hope you have fun in Unity!
you sir are my SAVIOR
For anyone who can't figure out where snap to grid is, click the little magnet thing next to the hashtag looking thing, over the scene panel where you see your game. If you can't click it, click the globe icon with a little circle in the bottom right to the left of it and set it to global.
tysm
Thanks man
I set it to global, but I still can't click it weirdly
@@senco445 restart unity
@@enook It worked, thanks!
"much better"
*Almost falls out of the map*
I used a trash can model for my player, and did some texture work on the ground to make it like a street, I then added paths on each side. For my obstacles I added debris and cars and stuff, I also imported a custom skybox. It's really fun using these tutorials as a basis and experimenting with your own themes and ideas. I've still got allot to learn though.
BoardOfCircuit k
BoardOfCircuit o
Awesome
Noiceeeeee
why did u write this?
I love how Brackeys is always so cheeful. It leads me to believe that being an indie game developer leads to a very fulfilling life.
Fulfilling maybe but tiring yes
sure, but you have to go through hell to get the fulfillment /hj
I'm pretty sure he made a lot more with his RUclips channel than developing games.
@@reno82 thats definitely true
his videogames are free but his youtube vids are monitized
@@reno82
Well shirt, I was hoping to make it big with a blockbuster game lol.
Now put your forward force at mabye... 4000
Me: 4000? Thats a bit to much but ok ill try it...
*presses play*
Me: WEEEEEEEEEEEEEEEEEEEEEEE
I have the same problem how to solve that?
@@zoeazalkonyszelleme2487 change the force to something less maybe ? maybe at 3000 or such
:)
@@zoeazalkonyszelleme2487 bruh just lower the force
@@zoeazalkonyszelleme2487 either lower the force or up the mass
This is one of the best and easiest to follow tutorial series I have ever watched.
Wow: almost 200 likes, I forgot about this
Indeed
Best one
agree
I completely agree! By the way I am the 100th like!
there are MORE?!?
When life hits you hard with corona, you resort to Brackeys tutorials...
@Geeboo lol
Indeed
same
agreed
Brothers please help me after I did all the steps that brackeys told in the video when I hit play my character didn't move guys please help me I checked my code it was correct please tell why my character is not moving
For anyone confused with the snap settings in 2021, it's called Grid and Snap settings. Also be careful that you don't set the X,Y and Z of the world grid to 2, but look for the X,Y and Z under the Increment Snap.
If you did accidentally changed the world grid, you can reset it when clicking on the cogwheel.
Hope this helps cuz I got confused there for a sec.
Uhm I actually need help with my player. Unlike his when ever my game starts my player movement script disables itself. As if it's touching the obstacle before the game even strts.
Thank You
@@blazer6972 don't know if this is too late because its been two months but I had the same problem. Just check the placement of your semicolons and don't have one after the if (collisionInfo.collider.name == "Obstacle") and instead place the semicolon after the movement.enabled = false;
hope this helps if you didn't already figure it out
thanks Finnix!
for anyone in 2022 its the little picture of a grid and a magnet above the scene view!
"it already feels much more responsive"
*proceeds to jump off the platform with full velocity
YEET
I have given the player a “break” button so they can stop themselves, I also added bridges that branch off to different lanes
cool
i will take that as a suggestion that is a great idea!
@Rahul Joshi Just add a keyword "s" and do the same you did with sidewaysforce except do it in opposite direction of forward force
Can you copy paste the code here pls
@@lionzzz5 it will be too long maybe on github
who else is doing this during quarintine
Me XD
YE brother me too
Yes, me too!
Yea mate me to
Me too! would not imagine there are so many like minded people :D
For
those using this as a reference or wanting to review specific parts of the lesson, here are some time-stamps of interest:
0:42: Creating a prefab
2:14: Changing view direction, switching between perspective and isometric
2:46: Adding a layer and making it non-selectable
3:13: Moving an object on a plane
3:20: Moving an object on a grid
4:36: Setting ForceMode to make left/right movement more responsive
5:40: Increasing drag to improve game feel
6:32: Adding fog
this should be top/second comment ngl, timestamps are so damn helpful in tutorials
Still doing gods work, hope you did it through the whole series
The force mode setting is make me way to fast can I have some help
@@youinbotheyamez4950 Did you remember to multiply by Time.deltaTime?
@@willpetillo1189 yes
I'm currently a web developer and I've been wanting to branch out into game development for quite a while. Recently, I started looking around for some simple Unity/C# tutorials and this series is by far the best thing I've found so far. Time has flown by so fast while following this tutorial. I can't wait to finish it! Thanks a million for the free resource links and tutorials. They've been super useful and insightful! Hopefully after this, there will be some gradually more advanced videos coming out.
for those looking for snap settings, the latest 2021 version has them somewhere else, right above the screen where you are visualy editing the game there is a magnet near a hash looking thing, that is your snap setting.
thx man
Thanks so much
thanks man
Me: Does the forcemode thing and doesn't change values
Also Me: d
The cube: *Adios*
Edit: Thanks for the likes! No one ever really notices my comments.
LMAO SAME
69th like, comedy
That fog made the game look so much better in just a simple click - just amazing
your videos are fantastic. unlike many other unity tutorials out there, you actually take the time to explain each little thing, which is just great.
This series is so much fun, after only a few videos I already wanted to add a new feature(jumping) so I took a break from watching the videos to get jumping figured out then I wanted the player to reset when they died instead of just stopping so I did that and then I wanted it to wait to reset and all of this took me like 30 minutes but it was worth every second and I am already loving game development
how did you do jumping?
To anyone having a problem with obstacles from prefab being put at y -0.5 of the y of the ground (or just half in the ground):
In the top left corner where you have tools like Hand Tool, Move Tool, Rotate Tool, on the right there are two options. In the tutorial he has it set at the "center" and "local", I had it set to "pivot" and "local". Changing the first setting to "center" resolved the problem to me.
T H A N K Y O U !
Had to dig too deep to find this. Thanks a lot.
@@MaxParasite No problem :)
markus u my friend are what we call in life an absolute legend
you are an absolute lifesaver thankyou!
You have clear all of my concept ...
Now, i am able to watch your E06. Thanks for providing such a great channel.
GOD I LOVE IT. i am INHALING your guides right now. I am studing "Multi Media Production" and i am in the 4th Semester and all i am thinking is "Meeeh... this is ok i guess". But now i am so god damn exited about Unity. Thank you so much. I have watched a lot of tutorials out there and i have to say, you are definitly the best one when it comes to understanding and learning.
I already found myself spending way too much time editing the level design, I'm having a lot of fun with this. Thanks for these tutorials man!!!!!
It also blows my mind that games like "the impossible game" are basically so easy to make using unity. Of course it requires a lot of fine tuning when it comes to the level design but the impossible game is not much more than your tutorial in 2D, or am I wrong?
If you need to find the Lighting its in, Window --> Rendering --> Lighting (then within lighting go to environment)
hope it helped :)
Tysm
TY
I'm so glad to have found these vídeos. They are amazing.
Brackeys actually the smartest programmer I've ever met. Even my teacher lets me make this game as a school project in quarantine.
For anyone wondering where snap settings is (Version 2021.3+), its the "Audio Visualiser" looking icon next to "Toggle Grid Snapping".
The best and pleasant tutorials I have ever seen. I have some idea, can I use Your videos and translate them to Russian in future maybe (of course with source link )? ;)
Can you teach me cyrillic?
@@chickeninabox без проблем, чувак:D
Happaro Happaro : why you watching this and i am smaller hacker ;) link:ruclips.net/video/NbOy-raaaNA/видео.html
Regards from serbia
This guy just makes game programming fun. I am always looking forward to more episodes ahaha
This is so brilliant, especially the fog thing. Thank you for this tutorial
I coded "L" to levitate so that when the player goes off the ground, you can bring the player back to the platform by press "L" basically means no gravity with forces.
thats something i kind of wanted to add. And maybe a screen vibration when it happens as well as a low humming effect.
SEND CODE PLSSSSS HAHA
Simple but really cool! I've always wanted to mess around with gravity. I'll try that too!
If you are watching in 2022, the lighting can be found under Window > Rendering > Lighting. I hope this helped people!
I almost gonna stuck for like a long time if i hadnt see this tnx for that
@@HabibaBinteRahman lol after 1 year I am still here!!! No problem!! =:)
Your videos are the only educational videos that truly emphasizes that learning is fun! Greetings from Bangladesh.
Thank you so much for this! You have a really good way of explaining stuff, and I'm finding myself learning a lot.
Can someone help I cant play the game in full screen. I can run it but it wont let me control the player
as soon as you click play, click the square
Thanks, worked.
OK, that works--but why do we have to do that? Why doesn't the game view just run normally and show us the game playing as it does when not zoomed? :-o
I have the same question, why is that? Are we missing some command that sets the player as the default focus point?
@Vali I also have the same issue and still no answers -_-
If you are doing this in unity 2019 or later, you may run into the issue where your prefabs being dragged into the scene are always dropped halfway inside your ground object. To fix this, in the top left of the scene window is a drop down that looks like a box with a red dot in it, click the arrow and change it to from 'Pivot' to 'Center'. Thats it! Should be fixed now! 😄
He is one of the best programing teachers on youtube. Keep it up.
Man this is helpful, i mean there are some simple techniques yet IMPORTANT that are easily to miss. Thank you alot.
Dude, I love these videos and I'm learning a lot, but you go so, damn, fast! I have to pause and replay several times for just one modification.
Agreed. I wonder why he bothers editing out all of his pauses because we are constantly pausing his video to keep up. He can save himself a lot of time in editing by just leaving the natural pauses in his speaking voice in the video. However this is a trend with most RUclips videos that every video must be edited to be as short as possible.
Yeah agreed, I've been changing the playback speed in the settings to .75, .50% speed. Makes life a lot easier.
I'm done with it! Thank you very much! I have questions: after i'm done with it, How to make it as .exe file, how to restart level after you touched obstacle, how to make Menu and how to make the end with checkpoint?
Making it this far means you are in the top 50%. Feel proud.
I'm loving this, since 14 i wonder to develop some simple game and i got to thank you for helping me with that dream, and yes, i'm doing this during quarantine.
For anybody having issues with your Prefab being in the ground when you click and drag to create it, or any other object: Make sure at the top left where all the tool buttons are, the button after the tools should say "Center", not "Pivot" :D
there would have been no way i would figure that out if it wasnt for this comment, thank you so much
this saved me a lot of headache. thanks man
for those who got confused about finding the lighting window... you should select : Menu => Window => Lighting => Settings
Hope I helped someone :)
best youtuber for simple game making I love this series
Thank you for helping me start to program in unity,you have made me love programing
In newer versions, you can open the Lighting tab by pressing Window > Rendering > Lighting Settings. I found this randomly after a long time.
Thanks a lot man you saved me a lot of time
Thanks! Was just looking for a comment that would help with this haha.
July 2022 Snap Menu.
Above your scene view in the top left corner there will be a few buttons.
The button that looks like a graph with a Y in it toggles the grid on/off
The button with a graph and magnet icon turns snapping mode on/off
The button with vertical bars lets you adjust the snap settings. The X Y Z you see at the top are the "Move X" "Move Y" "Move Z" options you see in the video. You can set the XYZ to each have a different value by hitting the (-) button left of the x.
boi you dam god will send you in heaven
thank you!!!
Im not a programmer, yet I'm glad I keep on continuing until this episode.
Dude, your tutorials are amazing. So helpful. Keep up the greatness!
I disable use gravity for the player when he collides, so when you get in an accident you are send into orbit :p
do you mind if I use that idea?
how did code that
@@b.g._.3828 it's just a setting for the rigidbody
@@b.g._.3828 Let me help.
In the PlayerCollision script declare a public varible like this
public Rigidbody stolenRigBod;
then save and go into unity on the player, drag the rigid body to the public variable you just declare then go back into the ide (probably visual studio) then put something like this
stolenRigBod.useGravity = false;
but change stolenRigBod to what you named the varible.
You're Welcome!
The menus have changed with the newest version of Unity, under windows there is no lighting, it is under rendering.
I am doing this during quarintine
but I always had been interested in it
This is so much better than those £200 udemy courses! Thanks so much! I'm learning so much more than I did from the courses.
Here's my notes so you don't have to rewatch the video. video 6: Gameplay. Prefabs: Drag a game object into your assets. This allows you to spawn items of the exact same type. If you change the properties of the item in your assets, it changes it for each duplicate of that item you use. Top right in the scene view, will allow you to change the axis you’re viewing it from.
To work in gridsnap mode, go to Edit>snap settings.
Player movement can sometimes feel sluggish, as your controls slowly build up momentum. We change this by ForceMode. Go to your playermovement script and go to where the controls are. In the X Y and Z area, add in ForceMode.VelocityChange. Example:
If (Input.GetKey(“d”))
{
rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, Forcemode.VelocityChange);
//This can feel better. You’ll also need to change the force numbers to be smaller.
To improve it even further, you can increase the drag. Higher drag, means things stop faster. This option is under RigidBody. Because you’re fighting against drag, you will need to increase the force you move at.
To change how far you can see, you can change your lighting. Go to Window>Lighting and dock it where you want.
Enable fog and it will allow you to change the color and view distance.
if (Input.GetKey(KeyCode.Space)) {
rr.AddForce(0,50,0);
}
I BELIEVE I CAN FLY
I BELIEVE I CAN TOUCH THE SKY
you can use :-
if(Input.GetKey(KeyCode.Space) && transform.position.y == 1){
//your jumping code
// this will make your player jump only when he is on ground...
}
i guess this was your problem...
try this
bool isGrounded = false;
void OnCollisionEnter(collision col){
If(col.gameobject.tag == ""terrain"){
isGrounded = true
}
void OnCollisionExit(collision col){
If(col.gameobject.tag == ""terrain"){
isGrounded = false
if(Input.GetKey(KeyCodw.Space)&&isGrounded == true){
//JUMP CODE :)
}
}
NICE xD
where do i insert this code?
@@ammarali8692 I think it'd be better to check if it collides with ground, but ok.
I've made Jumpy Cube game with the help of Brackeys videos. Such a nice guy to share all his skills with us.
Hey I managed to follow the tutorial up till here and I made it two players thanks for all the help I will continue with the series
So I made and infinite level type thing with help from the code in your dodge the block game. And in that code the random generation of blocks works like this:
using UnityEngine;
public class BlockSpawner : MonoBehaviour
{
public Transform[] spawnPoints;
public GameObject blockPrefab;
public float timeBetweenWaves = 1f;
private float timeToSpawn = 1.75f;
void Update()
{
if (Time.time >= timeToSpawn)
{
SpawnBlocks();
timeToSpawn = Time.time + timeBetweenWaves;
}
}
void SpawnBlocks()
{
int randomIndex = Random.Range(0, spawnPoints.Length);
if (randomIndex == 6)
{
FindObjectOfType().SpawnJumpPad();
}
for (int i = 0; i < spawnPoints.Length; i++)
{
if (randomIndex != i)
{
Instantiate(blockPrefab, spawnPoints[i].position, Quaternion.identity);
}
}
}
}
So I had an idea to add jumpppads to the game. So what I did was that i changed so that the blocks can spawn over the whole ground (by changing the 0 in randomIndex to -1). And I want to make it so that the jumppads spawn in when the blocks are over the whole ground (so when all spawnpoints generate a block). And I have figured out all the code for spawning the jumppads, but I'm stuck at fixing, when, the blocks spawn, so like when all the spawnpoints generate a block.
Does anyone have a solution for this?
@Papyrus the great39 Search for "CUBERUSH" on itch.io. I completed the game...well sort of. (Not done)
@Papyrus the great39 Commented this a year ago...
@@n0_l0gic can you help me?
When i duplicating cube as instructed in the vid and starts the game all cubes except the orginal one jumps. Can anyone help me?
How to add fog for newer versions. Top Right-ish. Window→Rendering→Lighting→(From Scene) Environment→Other Settings→Fog.
ty
thanks :)
I've been using this engine for a while now, but you JUST NOW taught me that there are snap settings. Brackeys...I could kiss you I'm so happy.
Thanks for the tutorials. Been following from start of the episodes. Great content!
"There's plenty of oport-unity"
Get out
@@theanachronism5919 Why so aggressive towards the comm-unity?
@@47Mortuus Haha very funny
@@47Mortuus Enough with the puns, or there'll be a ...mu..tiny?
Am I doing it right?
@@NafenX m-unity.
Hey brackeys, I would want to ask you would recommend me to watch your playlists, so which playlist first and second etc. Would be cool if you answer it! THank you! :)
There is one.
I just started learning unity and I am currently following this video.
this series is so simple and awesome!! :D
Brackeys, My player sideways movement doesn't work in fullscreen but it works when i try it in the edit mode thing. There is no console errors.
same problem
That's ptobably because your player window is inactive. The play button is outside the player window, so when you hit play, the window with the play button becomes the active one. To fix it, simply click the game window again after hitting play.
Thanks Klausiboy Kristensen that works for me!!
i know its been two years but thank you from the bottom of my heart ive been raging a lot
If you don't have a mouse to zoom in or out
Press Alt+right click
Bless your soul.
@@pat9986 np
If you dont have a Mouse to zoom in or out
Wait what if YOU dont have a Mouse just go away from unity
ctrl alt del
Just press Alt+F4 lol ;-;
Great tutorials as always! Keep it up and thank you!
Thank you for this video man ! :)) Im really happy to see those turorials :)
"it now feels much more responsive"
*Falls*
When I drag my prefab (the obstacle) on the ground, it automatically changed its Y position to 0.5 from the initial set 1. Couldn't figure out what the problem is.
edit: Tried googling about it and the only solution that I found is to drag the prefab into the hierarchy pane. And I can't drag it into the scene like in this video did.
Same problem, thanks for the tip!
got exactly the same problem. have you already found a better solution?
@@TaruzaGaming Try setting the Toggle tool handle position (in the toolbar) to center. This worked for me.
@@StrakkeTjakke cheers! i was messing with settings way back in one of the first tutorial videos and must have toggled this, not knowing what it did xD
These Ninja sized tutorials are the best. Thx a lot.
man you are the only youtuber that teaches unity that I understand thank you
my camera turns when i hit stuff..
You called this episode 5... last episode was episode 5....
Tho..... amazing tutorials :D
Thanks :D
i have a problem moving the player, A and D wont work when in fullscreen which is shift + space, any ideas ?
I still have that issue when i go fullscreen, any ways to solve this?
@@fearguspowers238 Maybe you're using caps lock?
this guy gives so much amazing information within 8 damn minutes
I'm learning a lot, thanks for the videos!
5:50
just so I know where I left off
ecksdee
You had better have come back dammit!
@@hevsuit5142 Why are you so NEGATIVE?
Nintendo Stuff 2 lol u think thats negative? straight away, you probably are a negative person yourself lol
@@watizdat89 Why did the bully laugh?
You put E05 in the title, its the sixth episode
+Mohammed Barwani Lol that was 3 months ago bro
See what I did there?
no please dont bring that cringe ass shit on this side of youtube
+Smiteful Gaming Who?
Your name perfectly matches with this comment xD
best thing in youtube yet
Super fun. Game reminds me of a classic I played a long time ago called Marble Blast.
5:27
ForceMode shows as error.
HELP!
EDIT: I just forgot to add a comma ahhahahha lol
Lucas Wolynec same
same...
can you send the line cuz it doesnt work for me
@@bearfeeplayz2168 sorry bro, its been a loong time. Dont have the code anymore
@@lucaswolynec1658 yeah it's ok I figured it out too, I had a different problem
If you have that problem, please watch the next video. "When I hit the Obstacle in the game, it passes through the Obstacle and then stops."
Does he say generally or january? That's been buging me since I started watching these series ;) But I find it really great how easy you explain all this, way better than any other tutorials or courses I've seen!
from time 2:10 to 4.00 i have seen it like 10 times. Toomuch info in too short time no dragging words like aaa heee uuu. thanks!!
When I try to increase my forward force to like 20,000. My player box goes very slow and stays the same
Double check the forward force's value in the Inspector Window under the "Player Movement" script. There's a weird thing with Unity where if you make a variable public in the code and adjust the variable's value IN the code, it doesn't always sync with the Unity window. So it might be best to always double check values from the inspector window.
I do not have any ideas how to move the player during the game,is there any instruction I missed?
Hah, I forgot about the Playermovement script......
Even I am having the same problem.
Got a working mini game in one short afternoon. Thanks. :)
you such awesome instructor!!
at 2020 your guide is very relevant. thank you :)
Makes a Great Tutorial gets Shit on for naming it wrong
Could you please make the next Episode about Level Management/menu
Philipp St. Check out his tower defense game, he covered that.
Can you show us how to respawn the Player?
I could tell you how you can just restart the game once you hit a obstacle if that's what you mean?
This guy is way too exited to be doing this. But theses videos are the best Unity tutorials I've seen. better than the official ones
I am watching ads and clicking on them so you can get paid. You deserve it. Thanks.
Please solve this problem :
When I press shift +space to view the game, the controls are not working i.e a and d, but they are working before.
It happened to my too what should I do??
Fond a the problem! After you press shift + space you need to press the screen. It is that easy don't know why it took me a day to finally get it.
same problem
Edit: Found the solution. Start game with ctrl + P, it works for me.
hey bro ....don't use shift+space , Instead of that in "game "window(that one the camera shows u now, the right one) in top of that u can see (display1 , free aspects , etc)......find "maximize on play" and click or toggle it on. now click on play and the screen will be large and u can use control keys
@@goodsoup6989 Ah thank you!
I know everyone says it but pls change title to EO6 your previoius episode was EO5
no the first one was a tutorial thing
and had a number sooo
he did
As of November 2021 this still works, although some stuff isn't in the same place
Dude thank you.. You're a very good teacher