Weapon Switching in Unity | Weapon System #2

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 126

  • @monkeyrobotsinc.9875
    @monkeyrobotsinc.9875 2 роки тому +4

    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

  • @knowOneGameHard
    @knowOneGameHard Рік тому +1

    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.

  • @rhymax7294
    @rhymax7294 2 роки тому +1

    Awesome VDO Father (Plai's child as you know me)

  • @Solidrigs
    @Solidrigs 2 роки тому +7

    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.

  • @StrachyDev
    @StrachyDev 2 роки тому +6

    Thanks Plai for every videos you made ! This is really useful and very cool :) !

    • @plaidev
      @plaidev  2 роки тому +2

      Glad you like them!

  • @decoy3641
    @decoy3641 2 роки тому +1

    You condense such a long (for the first time) process in such a short, easy to follow video! Thank you!

  • @edit.r4k
    @edit.r4k 2 роки тому +1

    when the world needed him the most, he came back

  • @felixensor2409
    @felixensor2409 2 роки тому +15

    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*

  • @raphoulefilou
    @raphoulefilou 2 роки тому +1

    Omfg i swear im so happy the ytb algorithm let me found this video, they are so usefull!

  • @Mxchyyyy
    @Mxchyyyy 2 роки тому

    Nice video. I loved that you used the Karlsson demo for showcase lmao

  • @Jomalion
    @Jomalion 2 роки тому +2

    your tutorials are AMAZING! Thank you a lot!

  • @NotHimKoja
    @NotHimKoja 2 роки тому +3

    Thanks works like a charm! Could the next video be about recoil?

  • @mincha9999
    @mincha9999 Рік тому

    bro is our next brackeys, love your content please keep making more of shooting system specially with bullet trails(kinda like karlson)

  • @SK-kl9gs
    @SK-kl9gs 2 роки тому

    Thank you for the tutorials! Keep them coming :)

  • @youssefbadawi8215
    @youssefbadawi8215 2 роки тому

    I missed ur sick tutorials bro

  • @akarsh9407
    @akarsh9407 2 роки тому

    I guess next dani video will be on nft, great video mate :)

  • @flickermarc6308
    @flickermarc6308 2 роки тому +3

    PLEASE do a ADS/Scope tutorial it would be the best next step in the series and would be a great thing to learn

  • @yugam6578
    @yugam6578 2 роки тому

    You are the only youtuber with these tutorials but bring videos fast

  • @bennydaboy6984
    @bennydaboy6984 2 роки тому

    The legend has left us again

  • @voyagetaker9505
    @voyagetaker9505 2 роки тому +5

    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)

  • @york9283
    @york9283 2 роки тому +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?

  • @RMC365
    @RMC365 2 роки тому

    These videos are great and simple, very nice

  • @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

  • @AboFroos
    @AboFroos 2 роки тому

    clean and awesome tuts ❤

  • @imlandfall
    @imlandfall 11 місяців тому +1

    I ran into a problem where when you switch weapons. You can shoot one bullet from the previous weapon. any fix?

  • @MrMikhaelJackson
    @MrMikhaelJackson 2 роки тому +1

    I love these tutorials, but how do I disable rapid fire on the pistol?

  • @themilkman1201
    @themilkman1201 2 роки тому

    BEST Tutorials!!!! But, for the next one could you add crouching?

  • @BadBomb555
    @BadBomb555 Місяць тому

    Anyway I could add a delay before switching weapon, to play switching animation and such before switching?

  • @michaelchen1046
    @michaelchen1046 2 роки тому

    thank you so much for these videos

  • @bigbluebuttonman1137
    @bigbluebuttonman1137 2 роки тому

    Thanks. It works without a hitch.

  • @shubhampatel8193
    @shubhampatel8193 2 роки тому

    wating for next part :))

  • @monkeyrobotsinc.9875
    @monkeyrobotsinc.9875 2 роки тому +1

    GOOD Video .

  • @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

  • @Khaled_khalil
    @Khaled_khalil 2 роки тому

    ty :] ... EPIC video

  • @spud7234
    @spud7234 Рік тому

    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

  • @keanezebean1
    @keanezebean1 2 роки тому

    HE'S BACK

  • @pocketcorner3309
    @pocketcorner3309 2 роки тому +1

    Your tutorials are so helpful bruh thanks a lot
    Could you make one on how to pickup a drop weapons similar to csgo style?

  • @X_EpicDev
    @X_EpicDev Рік тому

    I'd love to see a version that adds Aim Down Sights or Shotgun Support
    also explosive ammo or something could be cool

  • @BarbeelBarbeelBarbeel
    @BarbeelBarbeelBarbeel 2 роки тому

    He’s back

  • @anj_10
    @anj_10 2 роки тому

    I swear your the best UA-camr ♥️♥️

  • @JustNoxid
    @JustNoxid 2 роки тому

    straight to the point thank god

  • @Alan-jy5wr
    @Alan-jy5wr 2 роки тому

    Which theme do you use for visual studio
    its very nice and calm

  • @Cacti75
    @Cacti75 Рік тому

    Can you please make an ADS tutorial?

  • @partishdarji26
    @partishdarji26 Рік тому

    YOUR 100TH COMMENT!!!
    i wanted to know what should i do for a survival game WHERE i want pickup and drop guns???

  • @julekf9046
    @julekf9046 2 роки тому +1

    I am waiting for the mele weapon like knife sword or something like that

  • @IceyRhythm
    @IceyRhythm 2 роки тому

    lets go plai

  • @ronak3813
    @ronak3813 2 роки тому +1

    Hey, love u r videos but can u make advanced weapon video with projectile weapons with weapon switch?

  • @TheNuuttiPro123
    @TheNuuttiPro123 2 роки тому +1

    inventory? and pickup system

  • @subarunatsuki1902
    @subarunatsuki1902 2 роки тому

    Please more Videos! Would love to know to add sound to the gun

  • @adhviklalthoppe2214
    @adhviklalthoppe2214 2 роки тому +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 роки тому +1

      Dave/Game Development made one with his and his and plais script interlock

    • @adhviklalthoppe2214
      @adhviklalthoppe2214 2 роки тому +2

      @@NotHimKoja thx bro

  • @Ragnar_hg007
    @Ragnar_hg007 Рік тому

    When I start the game both weapons are visible, how do I fix that?

  • @Duxkd
    @Duxkd Рік тому

    can you make full based tutorial about "How to make a multiplayer shooter game" please :)

  • @ronak3813
    @ronak3813 2 роки тому

    can u make video on how to add slide and crouch in your fps controler

  • @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?

  • @mesostonks
    @mesostonks 2 роки тому

    can you make a tutorial on procedural gun animation when jumping or landing?

  • @МишаДубков-п4ы
    @МишаДубков-п4ы 2 місяці тому

    What the asset in video?

  • @axelsmaxel
    @axelsmaxel 2 роки тому

    where is tutorial no.3!?!?!??!

  • @snappy6720
    @snappy6720 2 роки тому

    Whaaaaat you're alive??????

  • @Bloodtac
    @Bloodtac 3 місяці тому

    3:26 both my weapons are on alpha 1 (nvm i fixed it)

  • @ideology8323
    @ideology8323 2 роки тому

    I sincerely hope you become the next brakeys. Or even better than him

  • @darkrehart
    @darkrehart 2 роки тому

    you are very underrated

  • @DevDreamz-k6m
    @DevDreamz-k6m 2 роки тому

    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

  • @voltywolty
    @voltywolty 2 роки тому

    can we expect a pick up system for weapons and other items?

  • @polix9999.2
    @polix9999.2 2 роки тому

    Tyy broo now just cool gfx

  • @ads4752
    @ads4752 2 роки тому

    Ty 🙏

  • @pxlisedvr
    @pxlisedvr 2 роки тому

    can you make a muzzle flash tutorial

  • @cuberkai1899
    @cuberkai1899 7 місяців тому +1

    ey bloodclat man yo script not work men it break my camera you bomboclaat

  • @MoodMall
    @MoodMall 11 місяців тому

    Pls help I have still problem with the coroutine

  • @crunked
    @crunked 2 роки тому

    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

  • @synkgd619
    @synkgd619 2 роки тому

    I have an idea for the next part of this. Recoil or animations

    • @plaidev
      @plaidev  2 роки тому +1

      It'll probably be visual / sound fx
      But yea I may consider it after that

  • @anj_10
    @anj_10 2 роки тому

    Can you please make a enemy tutorial

  • @KitagawaKen5502
    @KitagawaKen5502 2 роки тому

    make a sliding tut for the movement tutorial series plz

  • @DIM0NER
    @DIM0NER 7 місяців тому

    Bro can you do video "Weapon Effect Shooting" i will happy if you do it:)❤

  • @kryten719
    @kryten719 2 роки тому +1

    Very good video; although it has been 10 seconds and I haven't watched it

  • @hehehe_hussain1694
    @hehehe_hussain1694 3 місяці тому

    we need a vid for UI

  • @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.

  • @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

  • @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 роки тому +1

      Yea I probably will

  • @GoodTato
    @GoodTato 2 роки тому

    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 Рік тому +1

      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;
      }

    • @Dougyl
      @Dougyl Рік тому

      @@SparrowGamerGR Thanks i had this problem too

  • @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 Рік тому +1

      @@fragdummy just change this line "private bool CanShoot() => !gunData.reloading && timeSinceLastShoot > 1f / (gunData.fireRate / 60f) && this.gameObject.activeSelf;"

  • @Bilburt
    @Bilburt Рік тому

    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.

  • @NatsuDragneel12095YT
    @NatsuDragneel12095YT Рік тому

    Please Make Weapon System #3

  • @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

  • @ricdev6085
    @ricdev6085 2 роки тому

    I love it

  • @axelsmaxel
    @axelsmaxel Рік тому

    what happened to this series?

  • @cjigaming7550
    @cjigaming7550 2 роки тому

    finally regular lazy boi!!!!!!!!!!!!!!!

  • @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

  • @KitagawaKen5502
    @KitagawaKen5502 2 роки тому +1

    also grab and throw plz (don't want to be to pushy sry)

  • @voyagetaker9505
    @voyagetaker9505 2 роки тому

    IM THE 30 LIKE LETS GOOOOOOOOOOOOOOOO

  • @quinnbrosseau3217
    @quinnbrosseau3217 2 роки тому

    Another amazing video, you earned a subscription today, I hope you sucseed!

  • @donajello
    @donajello 2 роки тому

    Any tips on how to go about implementing bullet tracers like this ua-cam.com/video/cI3E7_f74MA/v-deo.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.

  • @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

  • @syedsadiq8631
    @syedsadiq8631 2 роки тому +1

    Hha bro were is hand !!!!??????👀👀

  • @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.

  • @nomgartt
    @nomgartt 10 місяців тому

    finish this plez

  • @jinn1074
    @jinn1074 2 роки тому

    ✨ p̶r̶o̶m̶o̶s̶m̶

  • @Flyen256
    @Flyen256 Рік тому +1

    ammo in scriptable object xD

  • @bigglasses2625
    @bigglasses2625 6 місяців тому

    I need you to please stop making variables/changing their names without telling us.

  • @MyHandsForWar
    @MyHandsForWar 5 місяців тому

    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.