FULL PICK UP & DROP SYSTEM for WEAPONS or ITEMS || Unity3d Tutorial

Поділитися
Вставка
  • Опубліковано 20 сер 2024
  • FULL PICK UP & DROP SYSTEM || Unity3d Tutorial:
    Since I just started my series on how to shoot with projectiles in Unity, I thought it would be cool to share how to make a full pick up and drop system :D
    Don't forget to subscribe if you enjoyed the video, and if you have any questions just write a comment, I'll answer as many as I can! :D
    Links:
    ➤ DOWNLOAD the SCRIPT: www.mediafire.c...
    ➤ DOWNLOAD the PROJECT (in the free-code-dave channel): / discord
    ➤ DON'T CLICK: bit.ly/2VcrDZt
    If you want here's the series about the GUN SYSTEM USED in the video:
    ➤ • SHOOTING with BULLETS ...
    🏹 Get Access to my RANGED COMBAT LAB! 🏹
    ➤ Trailer: • RANGED COMBAT LAB - Un...
    ➡️ Get Access to my full MOVEMENT LAB! ➡️
    ➤ Trailer: • MOVEMENT LAB - Unity P...
    Other interesting videos :D
    ➤ Full WALL RUN tutorial: • Full WALL RUN TUTORIAL...
    ➤ My FIRST YEAR of game development: • My FIRST YEAR of UNITY...
    Support me on Patreon:
    ➤ / davegamedevelopment
    Music used:
    ➤ Elevate - LiQWYD: • Elevate - LiQWYD (No C...
    ➤ Night Out - LiQWYD: • Night Out - LiQWYD (No...
    #UnityTutorial #PickUpWeapon #Unity3d

КОМЕНТАРІ • 752

  • @davegamedevelopment
    @davegamedevelopment  Рік тому +5

    If you need help with any of the code shown, just visit the "coding-help" channel on my discord server :D
    Also you can find many more tutorials on my channel in the "Tutorials!" playlist - I really hope they help you on your further GameDev journey!
    And in case you're interested in getting access to my full RANGED COMBAT LAB, with which you can create pretty much any ranged ability/weapon you can think of, check out the trailer:
    🏹 RcLab Trailer: ua-cam.com/video/j2YplilHjCA/v-deo.html
    Thanks so much for watching, hope this tutorial has helped you!

  • @taylormarinescu805
    @taylormarinescu805 4 роки тому +121

    This guy is such a good youtuber. He creates full, easy to understand tutorials and responds to almost every comments even if it's off topic. 100% liked and subbed :)

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +12

      Thank you so much! :D

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

      @@davegamedevelopment i dont know why the Pickup stuff didnt work
      the gun is droped but The pick up does not work
      but thx u helped us so much 😁😁

  • @creapermann6356
    @creapermann6356 4 роки тому +109

    I almost cried as it worked, i spent over 10h on it

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +48

      I feel you man... Sometimes coding stuff takes wayy too long :D

    • @bosstankproductions1304
      @bosstankproductions1304 3 роки тому +1

      Dave / GameDevelopment I have a question. Will it work if I just use Right click in the part where it says E or or what does the code need to say if I want right click pick up ?

    • @TUMENG-TSUNGF
      @TUMENG-TSUNGF 3 роки тому +1

      Input.GetMouseButtonDown(1)

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

      @Domantuso_gaming mate can you just say fuck and shit without censoring it

    • @bruh-gy6yx
      @bruh-gy6yx 3 роки тому +1

      @@developer2 lmao

  • @crazykidplayz6498
    @crazykidplayz6498 2 роки тому +16

    This man deserves more support his tutorials are amazing! I’m writing this comment to show all the support I can!

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

    This Guy Is A Such A Good Person, He Gives The Codes And Understands We Easily

  • @ilypavan
    @ilypavan 11 місяців тому +4

    Set Interpolate to :None
    if your object is not moving as your view camera.

  • @creapermann6356
    @creapermann6356 4 роки тому +2

    Thanks, i tried the last month to do a good pick up and drop script cause there is no one on youtube. You just got one new active member :) TY

  • @tabithagiblet1644
    @tabithagiblet1644 3 роки тому +1

    top 10% of Unity tutorials right here, and I've sure as hell watched pretty much all of them

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

    Coming back to these tutorials after learning c# and they are so much easier to understand!

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

    my game just became 1 step closer 2 done. Thank you so much for this tutorial!

  • @Justeeee115
    @Justeeee115 2 місяці тому +1

    Hi I've been working on top down 2d game and cant really find a good tutorial for pickup and drop weapons so I have no choice but to use this tutorial and after editing the whole script to work with 2d I've manage to make it work so awesome thanks for this tutorial helpful enough!

  • @disgraceme
    @disgraceme 2 роки тому +61

    Here's the script:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PickupGun : MonoBehaviour
    {
    public Gun gunScript;
    public Rigidbody rb;
    public BoxCollider coll;
    public Transform player, gunContainer, fpsCam;
    public float pickUpRange;
    public float dropForwardForce, dropUpwardForce;
    public bool equipped;
    public static bool slotFull;
    private void Start()
    {
    if (!equipped)
    {
    gunScript.enabled = false;
    rb.isKinematic = false;
    coll.isTrigger = false;
    }
    if (equipped)
    {
    gunScript.enabled = true;
    rb.isKinematic = true;
    coll.isTrigger = true;
    slotFull = true;
    }
    }
    private void Update()
    {
    Vector3 distaceToPlayer = player.position - transform.position;
    if (!equipped && distaceToPlayer.magnitude

  • @theokruger4900
    @theokruger4900 3 роки тому +4

    You my good sir is a legend among this community, insane tutorial💪🏻

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

    im so glad i can find a tutorial youtuber like you bc most of the other youtubers are just like do this do that then you will have this. but u explain what everything means wich is very helpful for beginners like me.

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

    super well done man! Even though it's almost a 2 year old video it helped me a lot.

  • @skyblade_studios
    @skyblade_studios 4 роки тому +4

    Thank you, I hope you helped many people, for some reason, this broke my entire game having to completely restart. Nothing against you, probably something i did wrong, but i hope you can help other people

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +3

      Oh sorry, I don't think it was your fault, sounds more like Unity's problem, normally a simple script shouldn't break your whole game... :(
      But glad your not angry, if you want you can still download the project file and check out how everything is set up there :D

    • @skyblade_studios
      @skyblade_studios 4 роки тому +3

      @@davegamedevelopment All good, just got a different tutorial for pick up and drop thanks for replying

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

    Absolutely amazing, thank you so much, my player can now pick up a flashlight in my horror game! 😁

  • @vishnuramesh2514
    @vishnuramesh2514 3 роки тому +3

    Mannn this is such an amazing tutorial! everything worked perfectly at one go! I wish you all the best with your channel!

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

      are you using his movement system and if so where does the guncontainer go to?

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

      @@itzdimi7569 I'm not using his movement system...but my gun container is the child of my camera

  • @BadBanana
    @BadBanana 3 роки тому +4

    Very nice
    Used it in my.personal project.
    Working well
    Enjoying playing with the script.

  • @Kosten47
    @Kosten47 Рік тому +5

    To everyone who has the problem with this line:" public ProjectileGun gunScript;" u have to use instead of ProjectileGun the name of the gun script u have to shoot and stuff. So Get the name from the gun script and put it instead of "ProjectielGun". for example it should look like this :public Gun gunScript;

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

    Thankyou so much Dave, works very well making my game so much better!

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

      Glad I could help!

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

      @@davegamedevelopment Sorry to ask, but would you know how to make dani's grid material, not the prototype grids one but the new one that he usesin his videos

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

    Dave you truly are amazing so far you are the only unity tutorial creator that shares his code for free and also the only one who has code that works first try love your tutorials they help me real good and it's easy to understand thank you so much keep it up

  • @AldinCraft
    @AldinCraft 4 роки тому +4

    Thanks you so much i keep finding this tutorial

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +1

      No problem :D Congrats for first comment btw :D

    • @imzary
      @imzary 4 роки тому +1

      @@davegamedevelopment you are an amazing guy (;

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +1

      @@imzary Thanks :D

    • @imzary
      @imzary 4 роки тому

      @@davegamedevelopment np :D

  • @duelsoldier3048
    @duelsoldier3048 3 роки тому +1

    Gotta say man seriously good content unlike any other youtuber! keep it up!

  • @useless.production
    @useless.production Рік тому +1

    You are the best! I hope you keep making these tutorials!!!!

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

    this guy is as good as Brackeys (R.I.P Brackeys YT Channel)

  • @Asensado
    @Asensado 3 роки тому +15

    Hey Dave, so I realized that when you pick up the gun, it just teleports to you. But when you throw it, it smoothly reacts to gravity and makes it feel that you're actually throwing the gun. I want to also feel that I am picking up the gun, not teleporting it to my hand. Anyways, nice video. Keep it Up!

    • @davegamedevelopment
      @davegamedevelopment  3 роки тому +8

      For this you need to learn a bit about the Vector3.Lerp and Quaternion.Slerp functions, then it should move smoothly from one point to the other :D
      But for some reason it didn't really work when I tried out

    • @lewis5796
      @lewis5796 3 роки тому

      @@davegamedevelopment slerp

    • @zeaglee3432
      @zeaglee3432 Рік тому +3

      Hi! I know it is bit late but anyway. I think you already solved it but for any chance if anyone is looking for this it is a bit simple but tricky.
      For this instead of setting local position in pick up you will do it in FixedUpdate(). (Note: I would love to share the script however I made many changes to the original version for my preferences)
      1) Just add two new parameters :
      float pickUpTime;
      bool pickingUp;
      2) Then you will chance script a bit. You will remove the part where you set your gun position. Instead you will add two lines :
      pickingUp = true;
      Invoke(nameof(PickUpFinished), pickUpTime);
      3) Make a new method :
      void PickUpFinished()
      {
      pickingUp = false;
      }
      4) Last step paste in these lines into FixedUpdate() and that is all :
      if (pickingUp && currentWeapon != null)
      {
      Vector3 zero = Vector3.zero;
      currentWeapon.transform.localRotation = Quaternion.Slerp(currentWeapon.transform.localRotation, Quaternion.Euler(Vector3.zero), Time.deltaTime * pickUpTime * 10f);
      currentWeapon.transform.localPosition = Vector3.SmoothDamp(currentWeapon.transform.localPosition, Vector3.zero, ref zero, 1f / (pickUpTime * 10f));
      }
      Note : These variables there are not that perfect. I haven't completed it yet put it does the job for now.
      I hope that is what you need. Good luck with your game!

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

      ​@@zeaglee3432 Thank you it helped me a lot, it's all working fine but when I change the pickUpTime on the inspector nothing changes so I'm wondering why? is it supposed to be act like that or not?

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

      @@zeaglee3432 says currentWeapon doesnt exist

  • @ScreeperIsBetterThanDream
    @ScreeperIsBetterThanDream 4 роки тому +5

    cool bro
    it helped me a lot with making a game in unity

  • @Xylidine
    @Xylidine Рік тому +3

    For those whose guns are falling through the floor when you drop it, try changing the size of the box collider and make it so it wont clip the floor when you throw it

  • @dumbguy1073
    @dumbguy1073 4 роки тому +2

    there u go mate ur new sub and a follower...i like ur content keep posting more..all the best

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

    This tutorial helped me a lot, thank u so much now i've eradicated what i was having trouble with. i love u mate, i mean i love u as a friend really... oh no... it is coming back

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

    Amazing content and explanations!

  • @goatedzr354
    @goatedzr354 Рік тому +2

    for anyone whose gun is still shooting even tho its unequipped, put the code that you put in hte start function in the update function. so it doesnt just exacute that from the start.

  • @tylerpurner7816
    @tylerpurner7816 4 роки тому +1

    First tutorial with pick up and drop combined. Thxx for that. Without this i would die

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

    My god, thank you soooooo much for adding the script download!!!!! :)))

  • @TheRealWhatKid
    @TheRealWhatKid Рік тому +4

    Hi, I know this video was posted 2 years ago, but hope you can help. I followed the tutorial and got done, but, when I click E it will go to what I set it to go (Item Container) to but then it just floats around and doesn't exactly stay with the Item Container when I look around. How do I fix this?

  • @thisisit.thisishowitends5181

    Great tutorial, Dave has the best unity tutorials

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

    It's perfect!
    Currently working on a simple FPS like Hotline Miami, but with Max Payne's slow motion (or SUPERHOT with generic slow-mo?). Ability to grab and throw guns was just what I needed.

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

    For anyone who is experiencing their weapons floating up on pickup try making a separate game object called "gun stash" or something and put all of your weapons inside there. it fixed the issue for me.

  • @cpt.ghostriley735
    @cpt.ghostriley735 8 місяців тому

    This video is much better than the others cuz now he's showing hierarchy

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

    I set the rigidbdy to extrapolate and continous dynamic but it still bugs?

  • @gaminganimator-qp2ir
    @gaminganimator-qp2ir 4 роки тому

    Been waiting for this one

  • @r0develop493
    @r0develop493 3 роки тому +6

    Well that's odd. I followed your tutorial and encountered a weird bug. When using extrapolate, my item would stay in place wherever i go but would still rotate. however when i switched it to none. it fixed it.
    Not sure if this has something to do with the new unity version but yeah. If anyone else encounters the same bug, that's how i fixed it. Not sure if it's a permanent fix, but it gets the job done.

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

      I've been trying to fix it for so long now but to no avail. Setting the interpolation it to none do actually fix it but the physics of the gun wouldn't be smooth when reacting to gravity or other rigidbodies. If anyone has a fix to it please tell me

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

      @@mhausage3454 hey bro did you ever find anything out? i just had to change interpolation to none and im hoping you found a fix for the rough physics?

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

    I need some help. When i pick up the gun the gun does not follow the player. It just stay in the air. But if i press left click the gun is shoting.

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

      same

  • @hannesnolle2003
    @hannesnolle2003 3 роки тому +1

    When i start the game the guns at the ground just slied away and if i pick them up i cant shoot. Can someone pls help me?

  • @_sidrs
    @_sidrs 4 роки тому +2

    You are just awesome dude !!! Thanks !!!

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

    Dani aproves about the player object

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

    what happens with me is my gun dont stay in my hand it starts going forward when i go backward and when i go backward it gos forward and ive tried turning off all rotations on the rigid body but it didnt work all I know is that everytime i enable the rigid body it stays in one place plsss help

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

      the only thing that works is the throw machinic which gets thrown from a far distance

  • @haru-qh5fw
    @haru-qh5fw 3 роки тому +2

    Did anyone else get a bunch of errors when trying this?

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

    So a slight problem. I imported a model and now it just shrinks it after I pick it up, I tried with a model I made and one I downloaded.

    • @clearnandimprove4604
      @clearnandimprove4604 3 роки тому

      make sure all parents are scaled at 1 1 1. The character camera weapon and container. if you need to change the size do it from the item in the project window/ go to the model option and change scale factor to what you need.

  • @boogaan8759
    @boogaan8759 3 роки тому +1

    you explained it that good i even did it in 2D game.

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

    Great tutorial, just one thing. After adding this, the shooting just broke. The bullets now fly backward and not out of my barrel. Any idea why this is happening?

  • @spiderstudios5032
    @spiderstudios5032 3 роки тому

    Thank you so much! This worked for me! You've earned my sub!

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

    the weapons does unequip and requip however when it unequips it teleports to 0,0 anyone know why?
    edit: it teleports because my weapon is a melee weapon with animations so once you unparent it, the weapon teleports to the location of the animation. to fix this simply disable the animation on Drop() and enable again on pickup()

    • @Saud.alhadhod
      @Saud.alhadhod 2 роки тому +1

      bro ur a life saver like u got no idea i had this issue in January 2021 and i didnt know how to fix it so i switched to unreal engine and made a whole game but now im back to unity tryna make a game but can u give me the script for the animation part like how to deactivate it when u drop the gun and activated it when u pick it up

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

      @@Saud.alhadhod yeah for sure it's like a line ilk go find it

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

      @@Saud.alhadhod
      full code is this the main thing is saving your animaot component to a variable (mines called anim) and adding
      anim.enabled=false/true on the drop and pickup functions
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class test : MonoBehaviour
      {
      public weapon gunScript;
      public Rigidbody rb;
      public BoxCollider coll;
      public Transform player, gunContainer, fpsCam;
      public Animator anim;
      public float pickUpRange;
      public float dropForwardForce, dropUpwardForce;
      public bool equipped;
      public static bool slotFull;
      private void Start()
      {
      if (!equipped)
      {
      anim.enabled=false;
      gunScript.enabled = false;
      rb.isKinematic = false;
      coll.isTrigger = false;
      }
      if (equipped)
      {
      anim.enabled=true;
      gunScript.enabled = true;
      rb.isKinematic = true;
      coll.isTrigger = true;
      slotFull = true;
      }
      }
      private void Update()
      {
      Vector3 distaceToPlayer = player.position - transform.position;
      if (!equipped && distaceToPlayer.magnitude

    • @Saud.alhadhod
      @Saud.alhadhod 2 роки тому +1

      @@stevejobs1609 thankk u sooo much bro i appreciate it❤️‍🔥

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

      @steve jobs omg tysm! i was so confused

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

    if I drop mine it goes under the map itself any ideas?

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

    thanks, after 3 days i finally found this video

  • @factorp2030
    @factorp2030 3 роки тому +3

    Why he sounds a bit like Brackeys

  • @mrreaper2425
    @mrreaper2425 3 роки тому +1

    Thanks man ur great help for who just start learning XD

  • @PostVROfficial
    @PostVROfficial 3 роки тому +1

    How do I add guns? if I add guns the just move with me. pls help

  • @xdmcreamysickalien9067
    @xdmcreamysickalien9067 4 роки тому +3

    One sentence for this video: YOUR AN ABSOLUTE LEGEND btw can you also make a vid of how to pick up grenade and throw it thank you

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +1

      Haha, thanks so much man! :D
      Also if you watch my 2 part series on Shooting with Bullets you should be able to make this grenade yourself :D (Just use an invisible gun to throw it :D)

    • @DAATChannel
      @DAATChannel 3 роки тому +1

      @@gaminganimator-qp2ir some people don’t know how to script yet

  • @SamuelArmer
    @SamuelArmer 3 роки тому +1

    go to throw the the 'gun' in my case just a cube, and it works, try again a second time and it plumets straight down, no momentum. Any help appreciated

  • @_lonely_3124
    @_lonely_3124 3 роки тому +4

    im a bit late, but when i made the gun a child of the container, the gun would rotate and aim upwards, i checked the transform and it was the exact same. Also, when i drop my gun, the gun would teleport upwards to a specific place and just float there, i checked through my script and it was the exact same as yours.

    • @danielmay1846
      @danielmay1846 3 роки тому

      I had the same problem, have you solved this yet please?

    • @playerplus5917
      @playerplus5917 3 роки тому

      I've the same problem and I still can't fix it. I think he will never respond again :(

    • @_lonely_3124
      @_lonely_3124 3 роки тому +1

      @@danielmay1846I think I’ve solved it, if your gun has an animation, when the idle animation is played, it will teleport to the root position (usually 0 0). So, you have to edit the gun drop script so it turns off the animation when it drops, and reenables when picked up. Remember to put the disable animation at the top so it disables animations first before dropping.

    • @_lonely_3124
      @_lonely_3124 3 роки тому

      @@playerplus5917 I think I’ve solved it, if your gun has an animation, when the idle animation is played, it will teleport to the root position (usually 0 0). So, you have to edit the gun drop script so it turns off the animation when it drops, and reenables when picked up. Remember to put the disable animation at the top so it disables animations first before dropping.

    • @playerplus5917
      @playerplus5917 3 роки тому

      @@_lonely_3124 I've a grappling gun, but I don't really know *how* to turn off the animations. I tried a lot, but it still teleports to the root position

  • @akshit170
    @akshit170 3 роки тому +3

    Hi, great video!
    I have a problem that when i put the script on more than one gun then i press E on any one gun the other gun comes to me please help.

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

      You need to set the "Equipped" bool correctly before you start the game :D

    • @akshit170
      @akshit170 3 роки тому

      Dave / GameDevelopment K, thanks a lot

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

    my gun when i shoot getting smaller how to repair?

  • @GILGIL1116
    @GILGIL1116 3 роки тому

    BEST PICKUP SYSTEM EVER THANK YOU SO MUCH

  • @SkelebyteStudios
    @SkelebyteStudios 4 роки тому

    i a shame you have only 1k subs. more people should know about you (also i like your vids they help me a lot so thanks 🙂)

  • @joey._rsd7261
    @joey._rsd7261 3 роки тому +1

    Everything is working good but whenever i drop the gun it goes back to 0 0 0 because i have my gun container in my fps cam, anyway i can fix this?

  • @watershub2481
    @watershub2481 12 днів тому

    Thankyou so much for helping

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

    I'm having an issue with the shooting. I want to start the game without holding the gun which works fine. The gun isn't equipped and I can't shoot it. I pick it up and I'm able to shoot it and it's marked as equipped. However, after dropping it again, I'm still able to shoot it. Is there a way I can fix this? Thanks

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

    i dont get the projectilegun part what exactly is that

  • @7PM-8
    @7PM-8 2 роки тому

    Really good tutorial!

  • @sp0ngebob561
    @sp0ngebob561 4 роки тому +5

    Hi great video btw but I have a problem
    You typed projectile gun which means I could also type the name of my weapon if I'm correct but it couldn't be found and asked if I'm missing a directive or assembly reference
    I need help please reply 🥺

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +2

      You need to take the exact name of your gun script (The one that makes your gun shoot :D)

    • @sp0ngebob561
      @sp0ngebob561 4 роки тому

      @@davegamedevelopment yup I found out yesterday lol thanks for the reply

    • @ezrafarwell393
      @ezrafarwell393 4 роки тому +1

      @@davegamedevelopment im confused, i try to rename it but it says that there is already a script with the same name

    • @davegamedevelopment
      @davegamedevelopment  4 роки тому +1

      @@ezrafarwell393 You probably used a name that's already used by Unity (like System, Input etc.) :D
      Try changing it :D

    • @ezrafarwell393
      @ezrafarwell393 4 роки тому +1

      Dave / GameDevelopment thank you so much!

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

    The type or namespace name 'ProjectileGun' could not be found (are you missing a using directive or an assembly reference?) Help me fix it!

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

      How is your gun script called? It either needs to be exactly "ProjectileGun" or you need to Change the variable type to whatever the name of your gun script is :D

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

      Thank you, I'll try that

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

    My gun keeps falling through the floor when i press q and throw, and i cant see it when i uncheck equipped. help?

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

    good shit, brackeys level!

  • @p_rest_in8768
    @p_rest_in8768 3 роки тому +1

    where do i change the gun script name someone help

  • @ramnathsharma9798
    @ramnathsharma9798 4 роки тому +1

    Cool tutorial keep it up 😃😃👍👍

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

    Love Your Channel! Perfect!

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

    HELP!! when i dont start with the gun equipped it doesn't work. when i pick it up, the gun keeps its position of where it was on the ground instead of teleporting back to vector3.zero. the gun is still parented when you pick it up though, but just isn't in the right position

  • @nixv2824
    @nixv2824 3 роки тому +6

    when i try to have multiple guns, if I don't parent to the camera, I cant pick it up. but if I do, it follows the camera even when on the ground

    • @dinamutan7637
      @dinamutan7637 3 роки тому +1

      Try making a storage system, where every Gun object you have is parented to GunContainer, but each has a key. When you press that key, it disables the current Gun Object and activates the Gun Object paired to that key.

  • @plawro6180
    @plawro6180 3 роки тому

    omg thanks so much for this, you helped me alot!

  • @TM-el5bt
    @TM-el5bt 4 роки тому +1

    Great Tutorial I learned so much and everything is working for me except one thing. I can't see other weapons I picked up and maybe you know why it's like this. But keep on that good work.
    Edit: I actually fixed it so GREAT tutorial

  • @acropolise2945
    @acropolise2945 4 роки тому +1

    Great content!

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

    How do I make it so I can have a secondary primary and a third option? I’m not using this script for guns it’s for items

  • @simonvutov7575
    @simonvutov7575 4 роки тому +1

    I loved this, its exaclty what i needed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

    What if I have multiple gun scripts?

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

    So I'm trying to add more than one gun but every time he picks up a new one it will fly in some direction

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

    Brooooo is anyone else having this problem, i press e and it picks up the weapon, it looks fine but as soon as i move the character starts glitching, not moving in the right direction and most of the time it just phases through the map, ive played with all the rigidbody controls, tried many varients which caused many glitches and the least glitchiest is the extrapolate and continuous speculative which is where i just fall through the map. the worst part is that the arrow keys get mixed for some reason, so up is left, down is making him fly, right makes him go backwards, etc etc etc etc. its just weird and idk if its the tutorial or my movement script, which i also worked on and played with to see if it was the problem, and i put my my movement and camera look parts of the script in normal update instead of fixed update... yeah obviously it didnt work just did the same thing so any ideas on how to fix this? should i get a new movement script? does anyone have a better fps tutorial???

  • @wanbungus
    @wanbungus Рік тому +2

    Hey when i use my pickup script, it works fine as long as the gun is in my camera and set to equipped. Any other weapons just don’t transform to the player when i equip them and im not sure why. i don’t know what’s wrong so if i figure it out i’ll update it here in the comments in case i get no replies

  • @a.technology1446
    @a.technology1446 4 роки тому

    Amazing content, thank u❤️

  • @Kasuga-
    @Kasuga- 3 роки тому

    GunSystem Script is not working.
    It is showing camshake is missing
    HELP!

  • @bigboichungus3744
    @bigboichungus3744 3 роки тому +1

    ok i need help the script works for the most part i can pick up and drop my guns and they start and stop working when i pick up and drop them but im having this issue where when they are in my hand and i move they move like 2x more than i do so if i move lets say 5feet over to my right the gun will move 10feet (maybe not exactly 2x but you get my point) and they jitter in a way when i move i have everything identical to what is in the video and it still wont work idk what the issue is please if anyone had this issue and was able to resolve it could you help me out

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

      U solved it now? I have the exact same thing

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

    my pickup class needs a return method

  • @tomthekong3877
    @tomthekong3877 3 роки тому

    Thank you so much this works very well you earned yourself a new sub.
    But i wanted to say that if i have a weapon without a gun script (for example a knife) it will say “Object reference not set to an instance of an object” & if i copy the script and take off the gun script reference it will think its another script so it will let me pick up both weapons at the same time.

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

    When i pickup my other weapon it flies away and then when i drop it and pickup something else, it disappears

  • @mikeydward
    @mikeydward 3 роки тому +3

    Love this tutorial really excellent and well explained. How would I apply it to Photon for a multiplayer game? I have been trying to get it to work but it seems to delete the object after I drop it meaning I cannot pick it up again.

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

    AMAZING!!! I THOUGHT IT WOULDNT WORK BECAUSE I HAVE A WHOLE DIFFERENT MOVEMENT AND CAMERA SYSTEM BUT IT DID, YOURE DOPE

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

      hey rob question when setting the weapon container script (gun container but its weapons since using a sword) do i still need to position the container to the side of the fps camera or is that already done through code? like
      transform.SetParent(WeaponHolder);
      transform.localPosition = Vector3.zero;
      transform.localRotation = Quaternion.Euler(Vector3.zero);
      transform.localScale = Vector3.one;

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

      @@dcry1003 place the weapon position where you want it to be while equipped, move the container to where you want it, make sure it isnt equipped. then reset the transform on the weapon itself and it should work

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

      @@linkdev3916 thanks rob got it working now!👍

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

      @@dcry1003 im glad i could help!

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

    you are legend my friend!

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

    Keep up monster 💜

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

    HELP!!!!!!!!!!!!! I cant understand why whenever I drop my weapon it goes to the center of the world. pls help me if you know how to fix.

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

      Are you using Vector3.zero anywhere in your code?

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

      ​@@davegamedevelopment found the problem! I had two off the same script on the weapon and it made some bugs thank you so much for the help and the amazing videos!!!
      only one problem the animator is overriding the position of the weapon any idea how to stop it without stopping the animator?