Тёмный

Weapon Switching in Unity | Weapon System #2 

Plai
Подписаться 7 тыс.
Просмотров 28 тыс.
50% 1

In this video I built on top of the last one and continue working on the weapon system by adding weapon switching.
PROJECT LINK: github.com/Plai-Dev/weapon-sy...
Like & Subscribe!
Timestamps
00:00 Intro
00:03 Changing Shoot Point
00:34 Adding More Weapons
01:15 Weapon Switching
03:27 Preventing Bugs
04:10 Outro
Socials:
Discord: / discord
=============================================================
#unity #tutorial #weaponsway #unityfps #fpstutorial #unitytutorial
Outro Music:
Anachronist - Oddities by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. creativecommons.org/licenses/...
Source: incompetech.com/music/royalty-...
Artist: incompetech.com/

Хобби

Опубликовано:

 

4 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 123   
@decoy3641
@decoy3641 2 года назад
You condense such a long (for the first time) process in such a short, easy to follow video! Thank you!
@DiazDryx
@DiazDryx 2 года назад
Great video as always! Btw I personally believe firing from muzzle can also be quite useful for building realistic FPS game where where the gun is pointing matters.
@SK-kl9gs
@SK-kl9gs 2 года назад
Thank you for the tutorials! Keep them coming :)
@monkeyrobotsinc.9875
@monkeyrobotsinc.9875 Год назад
the set and select weapons methods, the way you have them match up with the array index, ..... is nuts. i really like that. and the true false check for switching based on that. really nice. Line 39 is my favorite. 2:28
@StrachyDev
@StrachyDev 2 года назад
Thanks Plai for every videos you made ! This is really useful and very cool :) !
@plaidev
@plaidev 2 года назад
Glad you like them!
@ryanlol9851
@ryanlol9851 2 года назад
your tutorials are AMAZING! Thank you a lot!
@Michael-rt6eq
@Michael-rt6eq 2 года назад
Nice video. I loved that you used the Karlsson demo for showcase lmao
@knowOneGameHard
@knowOneGameHard Год назад
Its so funy that I was watching Unity Basic Weapon System Tutorial from this guy and was have problems with the shooting accuracy and some how ended up clicking on this video.
@mincha9999
@mincha9999 Год назад
bro is our next brackeys, love your content please keep making more of shooting system specially with bullet trails(kinda like karlson)
@AboFroos
@AboFroos 2 года назад
clean and awesome tuts ❤
@youssefbadawi8215
@youssefbadawi8215 2 года назад
I missed ur sick tutorials bro
@akarsh9407
@akarsh9407 2 года назад
I guess next dani video will be on nft, great video mate :)
@raphoulefilou
@raphoulefilou 2 года назад
Omfg i swear im so happy the ytb algorithm let me found this video, they are so usefull!
@RMC365
@RMC365 2 года назад
These videos are great and simple, very nice
@edit.r4k
@edit.r4k 2 года назад
when the world needed him the most, he came back
@NotHimKoja
@NotHimKoja 2 года назад
Thanks works like a charm! Could the next video be about recoil?
@yugam6578
@yugam6578 2 года назад
You are the only youtuber with these tutorials but bring videos fast
@rhymax7294
@rhymax7294 2 года назад
Awesome VDO Father (Plai's child as you know me)
@michaelchen1046
@michaelchen1046 2 года назад
thank you so much for these videos
@shubhampatel8193
@shubhampatel8193 2 года назад
wating for next part :))
@keanezebean1
@keanezebean1 2 года назад
HE'S BACK
@bennydaboy6984
@bennydaboy6984 2 года назад
The legend has left us again
@JustNoxid
@JustNoxid 2 года назад
straight to the point thank god
@Lumyk100
@Lumyk100 2 года назад
He’s back
@bigbluebuttonman1137
@bigbluebuttonman1137 2 года назад
Thanks. It works without a hitch.
@ads4752
@ads4752 2 года назад
Ty 🙏
@Khaled_khalil
@Khaled_khalil 2 года назад
ty :] ... EPIC video
@themilkman1201
@themilkman1201 2 года назад
BEST Tutorials!!!! But, for the next one could you add crouching?
@flickermarc6308
@flickermarc6308 2 года назад
PLEASE do a ADS/Scope tutorial it would be the best next step in the series and would be a great thing to learn
@felixensor2409
@felixensor2409 2 года назад
Great tutorial! Could the next video possibly be on recoil or screen shake because that would add to the "impact" of the game.
@NotHimKoja
@NotHimKoja 2 года назад
I would like a recoil one too but for screen shake you can use the Kings(Brackeys) screen shake
@GrowingEggplantion
@GrowingEggplantion Год назад
*GAME FEEL*
@spud7234
@spud7234 11 месяцев назад
Hey, im a bit dense so i might just be blind to a step, but if i interrupt the reloading by ending playtest during the reload, it just breaks the gun, it can't shoot or reload anymore and i have no clue why or how to prevent it from happening, i just reload a backup to fix it. wut
@anj_10
@anj_10 2 года назад
I swear your the best RU-vidr ♥️♥️
@PolyGameDev
@PolyGameDev Год назад
Thanks Brackkeys very cool
@monkeyrobotsinc.9875
@monkeyrobotsinc.9875 Год назад
GOOD Video .
@imlandfall
@imlandfall 6 месяцев назад
I ran into a problem where when you switch weapons. You can shoot one bullet from the previous weapon. any fix?
@voyagetaker9505
@voyagetaker9505 2 года назад
i wanna make a cool switching animation, but this script makes it very so theres multiple ways to make it, example: ... well, idk how to make that stuff i gotta learn more :/(oh yea and also, good job viber, very usefull... and cool)
@IceyRhythm
@IceyRhythm 2 года назад
lets go plai
@pocketcorner3309
@pocketcorner3309 2 года назад
Your tutorials are so helpful bruh thanks a lot Could you make one on how to pickup a drop weapons similar to csgo style?
@ImJustLucky0
@ImJustLucky0 2 года назад
whenever i load another scene it says, "MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it" can u please help?
@Alan-jy5wr
@Alan-jy5wr 2 года назад
Which theme do you use for visual studio its very nice and calm
@MrMikhaelJackson
@MrMikhaelJackson Год назад
I love these tutorials, but how do I disable rapid fire on the pistol?
@darkrehart
@darkrehart 2 года назад
you are very underrated
@polix9999.2
@polix9999.2 2 года назад
Tyy broo now just cool gfx
@york9283
@york9283 2 года назад
Hey you guys seem to know alot about this crap. Everytime I try to reload my ar the console says "coroutine couldn't be started because the game object "pistol" is inactive" and vice versa. How do I fix this?
@ricdev6085
@ricdev6085 2 года назад
I love it
@voltywolty
@voltywolty 2 года назад
can we expect a pick up system for weapons and other items?
@Ragnar_hg007
@Ragnar_hg007 11 месяцев назад
When I start the game both weapons are visible, how do I fix that?
@noahhall5777
@noahhall5777 Год назад
Is there a clever way of making weapons "unlockable" with this system? As in you can't equip a weapon until a condition is met, like the player having picked it up for instance
@DevDreamz-k6m
@DevDreamz-k6m Год назад
Is there a way to use the new Input system for switch
@theoneandonlylg3824
@theoneandonlylg3824 2 года назад
Very useful tutorial, could you please add weapon pickups next? I wonder how to make this script check if weapon is picked up and therefore determine to activate it
@mesostonks
@mesostonks Год назад
can you make a tutorial on procedural gun animation when jumping or landing?
@X_EpicDev
@X_EpicDev 10 месяцев назад
I'd love to see a version that adds Aim Down Sights or Shotgun Support also explosive ammo or something could be cool
@subarunatsuki1902
@subarunatsuki1902 2 года назад
Please more Videos! Would love to know to add sound to the gun
@partishdarji26
@partishdarji26 Год назад
YOUR 100TH COMMENT!!! i wanted to know what should i do for a survival game WHERE i want pickup and drop guns???
@muhamad.Barzani
@muhamad.Barzani 2 года назад
your tutorials are simple af. i have learned so much from one of your videos, and im about to watch all your tutorials. i have a project for 27th of march and i have to make a decent game and the map is my college, and i have 11 days to make it, im learning at the moment. keep up the good work, i think i will make it in time by watching your tutorials
@NotHimKoja
@NotHimKoja 2 года назад
WHY DO YOU NEED GUNS FOR YOUR COLLEGE WHAT ARE YOU PLANNING HERE?!
@manavthapar8465
@manavthapar8465 2 года назад
@@NotHimKoja nah… he’s doing the right thing… i say use nuclear weapons too
@MoodMall
@MoodMall 7 месяцев назад
Pls help I have still problem with the coroutine
@ronak3813
@ronak3813 2 года назад
can u make video on how to add slide and crouch in your fps controler
@crunked
@crunked Год назад
Please make another tutorial on adding particles to your guns when you shoot them and aiming down sight or even crouching and jumping im enjoying this alot please pick this tutorial back up
@ronak3813
@ronak3813 2 года назад
Hey, love u r videos but can u make advanced weapon video with projectile weapons with weapon switch?
@snappy6720
@snappy6720 2 года назад
Whaaaaat you're alive??????
@ideology8323
@ideology8323 Год назад
I sincerely hope you become the next brakeys. Or even better than him
@RMC365
@RMC365 2 года назад
Whenever I try to press the reload button, it doesn't reload the ammo, I did the code correctly. What will I do?
@sync3471
@sync3471 2 года назад
Send us a pastebin link with the code or something at least
@OctimusCrim3
@OctimusCrim3 Год назад
Does anyone know how I could print how much ammo the mag holds and how much is left? example: 13/18
@fragdummy
@fragdummy Год назад
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; public class AmmoCounter : MonoBehaviour { public GameObject WEAPON1; public GameObject WEAPON2; [SerializeField] private GunData gunData; [SerializeField] private GunData gunData2; [SerializeField] private TextMeshProUGUI ammoCounter; private void Update() { if (WEAPON1.activeInHierarchy == true) { ammoCounter.text = gunData.currentAmmo + "/" + gunData.magSize; } if (WEAPON2.activeInHierarchy == true) { ammoCounter.text = gunData2.currentAmmo + "/" + gunData2.magSize; } } } Make a canvas and add a TextMeshPro. After that, add the script to it and add the gun datas and gameobject.
@michaelchen1046
@michaelchen1046 2 года назад
will you integrate this into your movement project?
@Chris-lw5po
@Chris-lw5po 2 года назад
It already is, the first part where hes setting up the weapon and already has a FPS controller -- that controller is the one he built or at least similar enough to use this on it.
@GoodTato
@GoodTato Год назад
Hi, I don't know if you still read comments but when I switch weapons then fire it fires the current weapon as well as all the ones selected since last shot fired. Is there a fix for this?
@archieharrap5901
@archieharrap5901 Год назад
did you ever find a fix i have this problem too
@Matt-lm8tj
@Matt-lm8tj Год назад
same problem
@SparrowGamerGR
@SparrowGamerGR Год назад
well, i'm a bit late to this but here's the solution (paste this inside the Weapon switching script): private void Update() { int previousSelectedWeapon = selectedWeapon; for (int i = 0; i < keys.Length; i++) { if (Input.GetKeyDown(keys[i]) && timeSinceLastSwitch >= switchTime) { // Unsubscribe the event listeners of the previously selected weapon if (previousSelectedWeapon >= 0 && previousSelectedWeapon < weapons.Length) { PlayerShoot.shootInput -= weapons[previousSelectedWeapon].GetComponent().Shoot; PlayerShoot.reloadInput -= weapons[previousSelectedWeapon].GetComponent().StartReload; } selectedWeapon = i; // Subscribe the event listeners of the newly selected weapon if (selectedWeapon >= 0 && selectedWeapon < weapons.Length) { PlayerShoot.shootInput += weapons[selectedWeapon].GetComponent().Shoot; PlayerShoot.reloadInput += weapons[selectedWeapon].GetComponent().StartReload; } } } if (previousSelectedWeapon != selectedWeapon) { Select(selectedWeapon); } timeSinceLastSwitch += Time.deltaTime; }
@UglyDouglyss
@UglyDouglyss Год назад
@@SparrowGamerGR Thanks i had this problem too
@TheNuuttiPro123
@TheNuuttiPro123 2 года назад
inventory? and pickup system
@kryten719
@kryten719 2 года назад
Very good video; although it has been 10 seconds and I haven't watched it
@plaidev
@plaidev 2 года назад
lol
@adhviklalthoppe2214
@adhviklalthoppe2214 2 года назад
Hey, can you please make a video on how to add sliding to the rigidbody fps controller? Keep up the great work!!!
@NotHimKoja
@NotHimKoja 2 года назад
Dave/Game Development made one with his and his and plais script interlock
@adhviklalthoppe2214
@adhviklalthoppe2214 2 года назад
@@NotHimKoja thx bro
@Duxkd
@Duxkd Год назад
can you make full based tutorial about "How to make a multiplayer shooter game" please :)
@julekf9046
@julekf9046 2 года назад
I am waiting for the mele weapon like knife sword or something like that
@Matt-lm8tj
@Matt-lm8tj Год назад
Someone know why we shoot the fisrt bulelt with the 2 guns ?
@fragdummy
@fragdummy Год назад
yeah I'm having that problem as well. Have you fixed it yet?
@Matt-lm8tj
@Matt-lm8tj Год назад
@@fragdummy just change this line "private bool CanShoot() => !gunData.reloading && timeSinceLastShoot > 1f / (gunData.fireRate / 60f) && this.gameObject.activeSelf;"
@Cacti75
@Cacti75 10 месяцев назад
Can you please make an ADS tutorial?
@axelsmaxel
@axelsmaxel 2 года назад
where is tutorial no.3!?!?!??!
@KitagawaKen5502
@KitagawaKen5502 2 года назад
make a sliding tut for the movement tutorial series plz
@cjigaming7550
@cjigaming7550 2 года назад
finally regular lazy boi!!!!!!!!!!!!!!!
@DIM0NER
@DIM0NER 3 месяца назад
Bro can you do video "Weapon Effect Shooting" i will happy if you do it:)❤
@pxlisedvr
@pxlisedvr Год назад
can you make a muzzle flash tutorial
@donajello
@donajello 2 года назад
Any tips on how to go about implementing bullet tracers like this ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-cI3E7_f74MA.html as the Raycast is now done from the camera and not the muzzle?
@Chris-lw5po
@Chris-lw5po 2 года назад
keep the muzzle object and raycast the shot from camera but draw a tracer line from the muzzle to wherever your camera raycast hits? I haven't worked with this but it's a thought that popped into my head. May not be viable.
@swiftchuck
@swiftchuck 2 года назад
I know you might not see this but if you could if you are making a next video to make an Aim Option? Would really appreciate it!
@plaidev
@plaidev 2 года назад
Yea I probably will
@NatsuDragneel12095YT
@NatsuDragneel12095YT 9 месяцев назад
Please Make Weapon System #3
@quinnbrosseau3217
@quinnbrosseau3217 2 года назад
Another amazing video, you earned a subscription today, I hope you sucseed!
@voyagetaker9505
@voyagetaker9505 2 года назад
IM THE 30 LIKE LETS GOOOOOOOOOOOOOOOO
@anj_10
@anj_10 2 года назад
Can you please make a enemy tutorial
@synkgd619
@synkgd619 2 года назад
I have an idea for the next part of this. Recoil or animations
@plaidev
@plaidev 2 года назад
It'll probably be visual / sound fx But yea I may consider it after that
@vilag872
@vilag872 2 года назад
Hello plai ! I wish that you can do a third person player movement tutorial, that'll be awesome from ya !
@plaidev
@plaidev 2 года назад
Sounds like a good idea
@cuberkai1899
@cuberkai1899 2 месяца назад
ey bloodclat man yo script not work men it break my camera you bomboclaat
@axelsmaxel
@axelsmaxel 11 месяцев назад
what happened to this series?
@purplefrog8194
@purplefrog8194 2 года назад
Great tutorial, but when I switch weapons it still shoots bullet from previous weapon
@KoopaTheQuick3
@KoopaTheQuick3 Год назад
has anyone found a fix for this?
@fragdummy
@fragdummy Год назад
@@KoopaTheQuick3 yeah I need a fix as well
@KitagawaKen5502
@KitagawaKen5502 2 года назад
also grab and throw plz (don't want to be to pushy sry)
@creepyant
@creepyant 2 года назад
Bruh why is it always that when I add something to my game, you create a tutorial about it the very next day
@nomgartt
@nomgartt 5 месяцев назад
finish this plez
@Flyen256
@Flyen256 8 месяцев назад
ammo in scriptable object xD
@utx5809
@utx5809 2 года назад
Dose the king reply
@plaidev
@plaidev 2 года назад
of course 😏
@utx5809
@utx5809 2 года назад
@@plaidev bro I love your vids your a huge inspiration.
@syedsadiq8631
@syedsadiq8631 2 года назад
Hha bro were is hand !!!!??????👀👀
@jinn1074
@jinn1074 2 года назад
✨ p̶r̶o̶m̶o̶s̶m̶
@MyHandsForWar
@MyHandsForWar Месяц назад
Your code is literally impossible to follow because you autofill so much and use curly brackets so bizzarely. it's like trying to follow a monkey on speed.
@bigglasses2625
@bigglasses2625 2 месяца назад
I need you to please stop making variables/changing their names without telling us.
@Marco-yk8kp
@Marco-yk8kp 2 года назад
string enemyTag; public GameObject projectilePrefab; private NavMeshAgent navMeshAgent; public LayerMask monsterLayer; public float nextShot = 0f; public float fireRate = 4f; public float splashDamage = 30f; public float overTimeDamage = 15f; public float patrolRange = 10f; public float attackRange = 15f; public bool wonMatch = false; // Start is called before the first frame update private void Awake() { navMeshAgent = GetComponent(); } private void Start() { if (gameObject.tag == "Blue") { enemyTag = "Red"; } if (gameObject.tag == "Red") { enemyTag = "Blue"; } } public GameObject FindClosestEnemy(string tg) {
Далее
Unity Basic Weapon System Tutorial
10:47
Просмотров 156 тыс.
I Used Godot For 100 Hours, Here’s What I Learned
35:09
🎸РОК-СТРИМ без ФАНЕРЫ🤘
3:12:10
Просмотров 1,4 млн
How I Made a Satisfying FPS Controller
4:38
Просмотров 135 тыс.
Weapon Switching - Unity Tutorial
9:59
Просмотров 425 тыс.
Can You Beat Hitman 3 Without Breaking ANY Laws?
22:37
A new way to generate worlds (stitched WFC)
10:51
Просмотров 520 тыс.
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 699 тыс.
Телега - hahalivars
0:35
Просмотров 1,4 млн