SHOOTING with BULLETS + CUSTOM PROJECTILES || Unity 3D Tutorial (#2)

  Рет қаралды 75,019

Dave / GameDevelopment

Dave / GameDevelopment

Күн бұрын

Пікірлер: 281
@azizsayed8115
@azizsayed8115 3 жыл бұрын
BRUH, YOU CAN'T JUST STOP UPLOADING MAN. At least continue with this series. PLEASE CONTINUE WITH THIS SERIES
@ArmTheNub
@ArmTheNub 3 жыл бұрын
Thank you from the bottom of my heart. I've been searching and tried to write proper script that makes bullets ricochet and your videos help me develop a proper script using your methods. The stress was immeasurable and this is a big had taken all of it away. Again thank you.
@jackjacky4587
@jackjacky4587 4 жыл бұрын
Ur unity tutorials are honestly one of the best in KZbin, very detailed 👏🏻👍👍
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Thank you so much! Glad you like them! :D
@Maskeowl
@Maskeowl 3 жыл бұрын
@@davegamedevelopment helo i need help i wannto add bullethole walls how i can do that?
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
@@Maskeowl just an idea and I have never worked with that before, but try and see if you can add Pro Builder with that idea of yours.
@meiers8637
@meiers8637 2 жыл бұрын
If someone has the problem that the explotion repeats infinitely when it impacts, at least i solved it by selecting the explotion prefab and opening it on the inspector right on the upper right where it says open, and then unchecking the looping section in all three sub parts of the prefab.
@raymondvaldepenas6245
@raymondvaldepenas6245 4 жыл бұрын
If you have problems with your bullet which are not detected for collision with a game object with a "whatIsEnemies" Layer mask set with a tag of Enemy... try using continuous dynamic as a collision detection... :D
@flipsareflippingfun2971
@flipsareflippingfun2971 4 жыл бұрын
I just want to say these tutorials are absolutely helpful. They are also not too fast for me unlike some ppl say, for more experienced coders it is fine and you can pause anyway
@misterdoctor2872
@misterdoctor2872 4 жыл бұрын
Can do a tutorial on how to make animations for the weapons and how to implement them??
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Thanks for the idea :D Maybe I'll do that, but I'm not sure, I normally decide spontaneously :D
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
kzbin.info/www/bejne/gF62Yn-hbL-Emrc here ya go
@alexbasics2260
@alexbasics2260 2 жыл бұрын
Hey dave! I have a problem and when the projectile collides with something it explodes but after exploding the explosion effect its still there! and I dont know what to do... Could you help me? Nice vid btw!!! :)
@retlyfast4816
@retlyfast4816 Жыл бұрын
Do you still need help? I found way 1 uncheck loop (if you are using unity particle pack dont forget to uncheck child too) 2 Under particle system there is stop action change to destory
@carterearles9528
@carterearles9528 4 жыл бұрын
Thank you so much for what you do! I would have an it if like 1 if it wasn’t for these videos. I did so much research on invoke, and couldn’t find anything. Then you explain it in like 5 seconds in a video!
@fildaletnany
@fildaletnany 4 жыл бұрын
I have a problem. After the explosion, the script destroys the bullet and it says that the gameObject doesnt exist. Did i set something wrong? Edit: solved it, i had to use the prefabs of my bullets instead of the prespawned.
@Mike-de2yt
@Mike-de2yt 2 жыл бұрын
same, thanks you helped me out
@whitesheep1417
@whitesheep1417 2 жыл бұрын
I have the problem that my bullet gets destroyed like it should do but my explosion keeps coming over and over again and 1 bullets spawns 6 explosions for some reason. Do you guys have any idea to solve this?
@bobj1234
@bobj1234 2 жыл бұрын
how do you do that?
@cubercube605
@cubercube605 Жыл бұрын
@@whitesheep1417 have youo found it
@whitesheep1417
@whitesheep1417 Жыл бұрын
@@cubercube605 nope but i dont need it anymore i do not make games right now
@stevenjuana3920
@stevenjuana3920 4 жыл бұрын
Yet Again, Great Tutorial!
@FarseerAnimation
@FarseerAnimation 3 жыл бұрын
This is very detailed and concise, however I think it would really help the viewer if there was a little bit of a pause between actions. It can just be a little overwhelming for someone who is learning if you move on so quickly.
@friendlyhoovy5597
@friendlyhoovy5597 3 жыл бұрын
you are a saint my dude
@pizzapepperoni2592
@pizzapepperoni2592 2 жыл бұрын
Thanks for you tutorial bro!
@MrFyce
@MrFyce 3 жыл бұрын
there's no mention of custom projectiles as stated in the title?!
@Sp8dezz
@Sp8dezz 4 жыл бұрын
help please my explosion effect keeps looping when i shoot a bullet any help would be appreciated !.Thx in advance :)
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Open the bullet effect and in the particle system component turn off "loop"
@Sp8dezz
@Sp8dezz 4 жыл бұрын
@@davegamedevelopment thx it helped
@rayyan7818
@rayyan7818 4 жыл бұрын
@@Sp8dezz how do i do that?
@pebble8911
@pebble8911 4 жыл бұрын
@@rayyan7818 left click on your particle effect > inspection > loop off
@Dogmut
@Dogmut 4 жыл бұрын
@@pebble8911 I've done this but the effect is still looping?
@bauzi6549
@bauzi6549 4 жыл бұрын
Hello there! I am glad i found you Channel, your videos are really well made. Keep it up! Everything is working for me so far, ecxept that the bullets bounce on Walls, but always on a 90 degree angle. Do you know how this problem can be solved? Other then that, thanks for the Tutorial!
@bauzi6549
@bauzi6549 4 жыл бұрын
Oh, i found my Problem myself! I used a Cube instead of a Sphere as a bullet.
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
@@bauzi6549 K, glad it works now! :D
@crisiman97
@crisiman97 2 жыл бұрын
The link for the gunprojectile tutorial is blocked. How can i get it another way
@Ferenc-Racz
@Ferenc-Racz 4 жыл бұрын
He sounds as Brackeys :D
@L0rdBud
@L0rdBud 4 жыл бұрын
if only, rip Brakeys
@atsurao
@atsurao 4 жыл бұрын
ye i noticed too, rip
@rayyan7818
@rayyan7818 4 жыл бұрын
I have a problem sometimes the bullet shoots above or to the side of the attackpoint any fix?
@IQWLR
@IQWLR 4 жыл бұрын
i have a problem it says "the variable bullet of projectileguntutorial has not been assigned" your reply would be much appreciated
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
You probably didn't assign the correct bullet prefab :D You need to take the one directly from the Assets folder and drag to to your script. Don't take the one inside of your scene (Because it gets destroyed when starting the game) :D
@alsafah2727
@alsafah2727 4 жыл бұрын
Dave / GameDevelopment oh thank you very much I’m the same person just on different account
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
@@alsafah2727 haha ok :D
@thesqwisher7543
@thesqwisher7543 2 жыл бұрын
How do I stop the explosion from repeating when it hits a surface?
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
Destroy the projectile
@bennydaboy6984
@bennydaboy6984 4 жыл бұрын
Sorry to bother you again but it sometimes bounces away when i have it on 0 bounciness and explode on touch
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Is the rigidbody set on "continuous" and "extrapolate" ? :D
@bennydaboy6984
@bennydaboy6984 4 жыл бұрын
@@davegamedevelopment Never mind I fixed it by adding this script to the bullet using System.Collections; using System.Collections.Generic; using UnityEngine; public class Destroy : MonoBehaviour { [Header("Unity Setup")] public ParticleSystem immpactEffect; private void OnCollisionEnter(Collision collision) { if (collision.collider.CompareTag("ground")) { Die(); } } void Die() { Instantiate(immpactEffect, transform.position, Quaternion.identity); Destroy(gameObject); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } }
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@bennydaboy6984 are u new to unity lol
@bennydaboy6984
@bennydaboy6984 4 жыл бұрын
@@gaminganimator-qp2ir is that ment to be joke or...
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@bennydaboy6984 nah just wanted to murder someone
@kandy5129
@kandy5129 2 жыл бұрын
Hi there. I have a question about the bullet. Once the bullet lifetime is over it just doesn't wanna shoot. The error i'm getting is GameObject has been destroyed but you are still trying to access it. How do I make it so that only the currentBullet is destroyed and not the actual bullet itself?
@Waltr_Black
@Waltr_Black 2 жыл бұрын
ayo same idk how to fix it...
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
@kandy5129 , @luckyRoblox You need to create a prefab of the bullet and put that into the bullet slot of the gun! To make a prefab of the bullet object, simply drag and drop the bullet object down into the Project window. Then take that object (from the Project window you just created) and drag it into the slot.
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
@@Waltr_Black :D check my comment
@Waltr_Black
@Waltr_Black Жыл бұрын
@@thelegendarymushroom80 tysm bro
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
@@Waltr_Black always bro!
@AldinCraft
@AldinCraft 4 жыл бұрын
Wow nice
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
AldinCraft Thanks!
@KaijuMike
@KaijuMike 2 жыл бұрын
howdy. I've been using your guides to help me out with a school project, but I seem to run into a problem related to damage. I set the health of an enemy to 300 and the player at 100. both of their bullets have been set to 25 damage, but they do much more. the enemy kills the player in one hit and the player kills the enemy in one hit. (looking at the inspector, the enemy goes from 300 health to -400 to -525) maybe it was something that I did wrong related to the health ints? I could really use some help to figure out what I did wrong.
@KaijuMike
@KaijuMike 2 жыл бұрын
figured out a part of it. for some reason, having the life time make it explode at the end did a lot more damage for some reason. also having the collisions set to 1 or 0. with collisions at 2 and changing when from explode to delay when max life hits 0, the enemies don't do friggin 30x the damage. they still do more than 25, but now it's only a consistent 50.
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
As long as it's consistent, it's usable :D If it still bothers you though make sure to debug how often the TakeDamage function gets called (it's probably 2 times), then figure out from where it's called exactly and use some kind of bool/timer that makes sure you can't call the function twice within like 0.1 seconds
@catman7474
@catman7474 2 жыл бұрын
yo you just got to take off the Invoke("Delay", 0.05f); and put Delay(); or just make it faster what its doing is its hitting multiple times
@maxsoto6015
@maxsoto6015 3 жыл бұрын
how do u make the particle effect disssapear from the hierarchy after the explosion
@YunaHelloHello
@YunaHelloHello 3 жыл бұрын
Had the same issue, here's my fix. When you instantiate your explosion in void Explode, you can store it as a game object; such as "GameObject impactGO = Instantiate(explosion, transform.position, Quaternion.identity); " where impactGO is the temporary variable name I gave it. Then after the Invoke method, you can put in "Destroy(impactGO, time)". This should destroy the Instantiated explosions after your set time. You can set the time to however long you want the clones to last, but I would suggest keeping it longer than the Invoke method time.
@lokosstratos7192
@lokosstratos7192 Ай бұрын
thank you!
@BertelsZera
@BertelsZera 4 жыл бұрын
I have a problem. I set my lifetime to 10 seconds and when that 10 seconds end I can't shoot anymore, It says that the object has been destroyed buy I'm still trying to access it. Can anyone help?
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
You need to make a prefab out of your projectile, and then assign the real prefab from your Assets folder (not the projectile from your scene, because it gets destroyed after 10 seconds) :D
@watercat1248
@watercat1248 4 жыл бұрын
just realize i dont konw haw to make the ammo to destroy wean the teach the wall i try your ammo system to see if have properly for this
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
not mine but here ya its from benny da boy using System.Collections; using System.Collections.Generic; using UnityEngine; public class Destroy : MonoBehaviour { [Header("Unity Setup")] public ParticleSystem immpactEffect; private void OnCollisionEnter(Collision collision) { if (collision.collider.CompareTag("ground")) { Die(); } } void Die() { Instantiate(immpactEffect, transform.position, Quaternion.identity); Destroy(gameObject); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } }
@ogWeener
@ogWeener 4 жыл бұрын
hi bro.... i have a problem in my game with shooting... if I shoot at an object, the bullet flies around the object and flies in a different direction.
@atsurao
@atsurao 4 жыл бұрын
me too did u find a way to fix it?
@ogWeener
@ogWeener 4 жыл бұрын
@@atsurao no 😅
@atsurao
@atsurao 4 жыл бұрын
@@ogWeener oh, if you don't mind me asking did you find a way to do this in a different way or are you stuck just as I am?
@ogWeener
@ogWeener 4 жыл бұрын
@@atsurao yeah😂, I'm just stuck and try to find the way to fix it
@ogWeener
@ogWeener 4 жыл бұрын
Okey, I think... I could create server for all people which have this problem
@whitesheep1417
@whitesheep1417 2 жыл бұрын
I have problems with damaging my enemys can you make a video on that topic please?
@marcamooo
@marcamooo 2 жыл бұрын
hey i was wondering if it was possible to just use the recoil part of the script? I wanted to use this type of recoil to try and mimic a rocket jumping type feature in my game but i have no idea how and when i tried this tutorial out, i noticed that there was a knockback like recoil. I dont know a whole lot about unity and c# so could you help me with using the same knockback as u do you in the projectile gun script? Thanks!
@brunomuller6356
@brunomuller6356 4 жыл бұрын
hey dave i am working on a 3d shooter but everytime i hit something it says Tag: Enemy is not defined. do u have a solution XD
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Did you declare the tag first? :D Inside of the Unity inspector you need to open the tag list and make a new Tag called "Enemy", then put all of your enemies in there :D
@Rabudia.
@Rabudia. 4 жыл бұрын
my bullets are not moving how i add a force to my bullet?
@Zebonsh
@Zebonsh 4 жыл бұрын
Idk?
@zypherone
@zypherone 2 жыл бұрын
They aren’t moving because they might be kinematic
@sanjayrajasree791
@sanjayrajasree791 4 жыл бұрын
My enemy damage function is not working, can anyone tell me?
@clinton2098
@clinton2098 4 жыл бұрын
Hi guys, im trying to use this system but when the explosion and muzzle flash effect are played they continue playing and i cannot figure away to destroy them in game, it would be really helpful if someone could help me out. Thankyou.
@haydenkelley9806
@haydenkelley9806 3 жыл бұрын
Im alittle late and you might have figured this out, but, you need to turn off looping
@AZASeraph
@AZASeraph 3 жыл бұрын
Hey I'm late so probably can't help u but turn looping off
@clinton2098
@clinton2098 3 жыл бұрын
@@AZASeraph lol yeah a Lil late, but thanks for helping out
@Usajz
@Usajz 4 ай бұрын
I have problem with recoil. It doesnt work and all and im not sure if i should add the rigidbody to empty object (folder) with Player or to the cyllinder.
@ImnotAbelsuni34
@ImnotAbelsuni34 8 ай бұрын
Hey, i have a problem where my bullets spawn at a random position and i don't know why... There are no errors or anything.
@Hyphen3372
@Hyphen3372 3 жыл бұрын
one question can you make it so that when you have 0 bullets it will play a reloading animation with this script advance thxn
@misc-i6q
@misc-i6q 3 жыл бұрын
I tried but it was crazy buggy, if I get it to work I'll reply
@Hyphen3372
@Hyphen3372 3 жыл бұрын
ok D4ngerous, very cool.
@whomp3817
@whomp3817 2 жыл бұрын
idk how important this is to you anymore, but you'll need to set up an animator and create a trigger. For example: Reload. Then in your script, you add: "public Animator anim;" Then you put inside the reload function: "anim.SetTrigger("Reload"); Then you have to make transitions using the animator and your idle, reload, and shoot animation, which is a whole other hassle. I recommend watching Brackeys gun tutorial video, because he covers the creation of animations and how to use the animator in that. Good luck!
@vfwarlordforever9589
@vfwarlordforever9589 2 жыл бұрын
I'm curious, why do I set the bullet's rigid body to "interpolate"? The gravity part I get.
@user-qv5uy1ce7x
@user-qv5uy1ce7x Жыл бұрын
but if i shoot to many bullets it isnt gonna bug my game since the bullets dont get destroyed?
@peerfekt8903
@peerfekt8903 3 жыл бұрын
for some reason its not working. I downloaded both of the scipts, after my own didnt work, but it still dont. i dont knoow why
@maarc_
@maarc_ 2 жыл бұрын
THANKS, but what if your Player doesnt have a rigid body?
@halivudestevez2
@halivudestevez2 Жыл бұрын
very professional!
@soksopanha7348
@soksopanha7348 3 жыл бұрын
Can someone tell me how to destroy your bullet when it collide. I really need help with that
@ion123v
@ion123v 3 жыл бұрын
Yeah i need that too
@ion123v
@ion123v 3 жыл бұрын
Create a script and add it to the bullet and then create the void that is responsable with collides and then an if statement that if it collides with the given tag then write in the curly brackets Destroy(gameObject);
@Tiltolet8917
@Tiltolet8917 3 жыл бұрын
So, I have a problem with this. On high speed bullets keep bouncing of the player, what can I do to fix that?
@sparkestic1238
@sparkestic1238 3 жыл бұрын
Same here.... Do you find any solution
@MrFyce
@MrFyce 3 жыл бұрын
#3 Please!
@big_poo7736
@big_poo7736 2 жыл бұрын
i may just be doing too weak of a force but how would i get it so that i can rocket jump
@foolishlue
@foolishlue 2 жыл бұрын
when the bullet explodes, it just keeps exploding long after the bullet is destroyed and i dont know whats wrong
@GibsonYouTube
@GibsonYouTube 4 жыл бұрын
hey, I've been having a pretty strange bug. whenever I walk forward while shooting, I get propelled forward really quickly. my guess is that it had something to do with the Bullet's Sphere Collider, and I was right. I turned off the Collider, and it was all fine. but, if I have my collider off, and it can't collide with anything (so enemies, the ground, etc...). I'm kinda lost on what to do. I tried having the script turn the collider off and on whenever the player was touching it, I messed with the physics engine, I've done everything that I can think of. if you or anyone has got any ideas on how to fix this that would be amazing! Keep up the good work man.
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Uff... I had the same issue, even tried the same stuff as you first :D The solution is to make a "whatIsBullet" and "whatIsPlayer" Layermask (and of course assign them to player and bullets :D). Afterward, you can open the "Physics" settings of your project, scroll down to the Layer Collision Matrix and uncheck the box where "whatIsBullet" and "whatIsPlayer" cross. This way bullets won't collide with the player at all :D Hope that helps!
@GibsonYouTube
@GibsonYouTube 4 жыл бұрын
Dave / GameDevelopment I actually did that, but I fixed the problem. The problem was that I only set the player object to the WhatIsPlayer tag, and not any of the children. Which means that the bullet was probably colliding on the Gun itself lol. Thanks for help!
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@davegamedevelopment i have 2 problems 1 i fly 2 how to make that enemys die
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@davegamedevelopment ima use the ray cast gun but how to add sounds plz tell
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
@@gaminganimator-qp2ir Here a tutorial on how to add sound: kzbin.info/www/bejne/bIC3ZWamq7qsnLs&ab_channel=Brackeys And are you using my movement script? :D
@misc-i6q
@misc-i6q 3 жыл бұрын
Can you make a tutorial on how to make a sword? I want to add a katana that I made to my game but don't know how.
@priyadaksheshpatel8384
@priyadaksheshpatel8384 4 жыл бұрын
Hey my bullets don’t explode when they touch something plz help
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Check if the collision counter is really working and if the maxCollisions are set to something like 1-3 :D
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@davegamedevelopmentcoz of the bullets the gravity seems to be very weak but if i delete script all works fine can somone help me out i did turn of the between players an bullets
@joeass2399
@joeass2399 4 жыл бұрын
@@gaminganimator-qp2ir learn English or some language before learning a programming language
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@joeass2399 dont you worry i know english i wrote that down when it was midnight i mean i was very sleepy
@joeass2399
@joeass2399 4 жыл бұрын
gaming animator 1357 o ok sorry
@priyadaksheshpatel8384
@priyadaksheshpatel8384 4 жыл бұрын
Can you make the bullets stick to things plz
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Already did that, if you download the project file over my discord you'll find an order full of premade projectiles (splitting, sticking, spawning, teleporting etc.) :D
@XCalibur_EX
@XCalibur_EX 3 жыл бұрын
So there seems to be a problem with how the spread is set up, if you aim off into a space with no objects the spread is 0, and if you are extremely close to an object the spread is ridiculously high
@thelegendarymushroom80
@thelegendarymushroom80 Жыл бұрын
same here, did you find a solution?
@kolczuritto5194
@kolczuritto5194 8 ай бұрын
yo, how to make the bullets disappear on impact?
@mrzack4299
@mrzack4299 2 жыл бұрын
Why are the links Bitly?
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
To shorten them
@BLACKEDSNEPER
@BLACKEDSNEPER 2 жыл бұрын
@@davegamedevelopment but they are broken + when i fixed it i couldn't download it. can you paste the code or give me a different link(not in media file)
@KingRingsting
@KingRingsting 4 жыл бұрын
hey, can anyone help me with my bullets, the damage is not consistent at all as my enemies have 100 health and i set bullet damage to 30 and sometimes it kills in 1 shot sometimes it kills in like 5, any help?
@zypherone
@zypherone 2 жыл бұрын
Did you ever find a fox for this? I know why it’s happening but I’m looking for a fix
@KingRingsting
@KingRingsting 2 жыл бұрын
@@zypherone i think i fixed it ages ago but i deleted the project sorry :(
@zypherone
@zypherone 2 жыл бұрын
@@KingRingsting nah it’s ok I fixed it and I’m passed all that. Appreciate it bro
@KingRingsting
@KingRingsting 2 жыл бұрын
@@zypherone good job on fixing it stuff like this can be so annoying
@zypherone
@zypherone 2 жыл бұрын
@@KingRingsting I know right? This is my first game that I’m actually making progress on though. In case your curious I’m making a cod zombies inspired shooter with robots instead of zambies and parcore and upgradable weapons
@ethancantcode
@ethancantcode 2 жыл бұрын
hwo do I make the bullets despawn when they hit the target
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
Give them a new script, and inside of the void OnCollisionEnter function, just use Destroy(gameObject)
@ethancantcode
@ethancantcode 2 жыл бұрын
@@davegamedevelopment Wow thanks its amazing that you actually answered since this video been out for more than a year
@RealJares
@RealJares 2 жыл бұрын
please help me my bullets are invisible i have hid them an then undid it but even now when i shoot i can't see them i followed the other tutorial, everything was working fine but i just couldn't see the bullets man, please help me out with this
@LBLBLBLBLBLBLBLBLBLB
@LBLBLBLBLBLBLBLBLBLB 3 жыл бұрын
I'm experiencing a bug where the Explode method will instantiate 3-5 explosions at a time, making the damage dealt somewhat random. I notice it goes away if I comment out the Invoke function. It seems to be going through the function multiple times until that 0.05 second delay is over, but I'm not sure why. I have some other scripts running, so that may be the issue, but I'm curious if anyone else had the same issue.
@ethanalkout949
@ethanalkout949 3 жыл бұрын
my explosion effect never stops playing actually
@mavelan
@mavelan 3 жыл бұрын
happened to me too
@lukashere7803
@lukashere7803 3 жыл бұрын
Did u find a fix?
@bobj1234
@bobj1234 2 жыл бұрын
same here. did u find a fix?
@dwkz1581
@dwkz1581 Жыл бұрын
I just had this issue too but i fixed it, i know i'm 2 years too late but all you need to do is decrease the delay, the bug seems to happen when the projectile uses up its collision limit, then it collides multiple times during that delay period, reducing the delay period drastically makes it only explode once.
@CuitoFlo
@CuitoFlo 6 ай бұрын
i have a problem, you know the bullets destroy themselves after the amount of max lifetime you put right, so since they all destroy themselves the gameobject of the bullet goes missing and projectile gun breaks cause theres no reference left
@CuitoFlo
@CuitoFlo 6 ай бұрын
nvm i fixed it ty for the tutorial very helpfull
@PolyPixelFusion
@PolyPixelFusion 2 жыл бұрын
How can we make the guns have sounds when firing?
@tinylarkl1421
@tinylarkl1421 Жыл бұрын
Use an audio source
@legoalternator2.014
@legoalternator2.014 2 жыл бұрын
ok so im making a game but i have a problem im triing to make a mountabale turet like you se in fairs tose canons but idk houe to make a turet cod you do a video were you make a canon in ferst person tat wen you pres somting you become the canon and control it also the ammo must bounce
@legoalternator2.014
@legoalternator2.014 2 жыл бұрын
and teres no video on houe to make sutch a ting
@Simon-Alexis
@Simon-Alexis 2 жыл бұрын
Very late but if I use a character controller and not a rb how can I add a recoil? Nice video btw super useful!
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
With a cc, I'm guessing you calculate a Vector3 for you velocity and then apply it with cc.Move(). In that case you would need to add a Vector3 that points backwards from your player to this velocity variable after you shooot, and then subtract it after some time to stop the recoil again.
@Simon-Alexis
@Simon-Alexis 2 жыл бұрын
@@davegamedevelopment Makes a lot of sense, I’ll try that thx a lot
@nat22157
@nat22157 3 жыл бұрын
When i get too close to an object with a shotgun, or a high spread weapon, the bullets fly everywhere and nowhere near the target, is there a way to fix this?
@magma5267
@magma5267 3 жыл бұрын
did u find a fix?
@nat22157
@nat22157 3 жыл бұрын
@@magma5267 kinda, instead of using a hit point, i made the range a float and then it works for the most part. And a bool to choose between using a raycast and a float
@zeckl1664
@zeckl1664 2 жыл бұрын
How can we add sounds to this script pls help
@ethanalkout949
@ethanalkout949 3 жыл бұрын
i need help asap, the explosion particle never stops playing after bullet destroyed.. thanks in advance
@dwiNExx
@dwiNExx 3 жыл бұрын
Un check the loop checkbox in the particle
@001Camera
@001Camera 3 жыл бұрын
Same
@001Camera
@001Camera 3 жыл бұрын
@@dwiNExx it still wont work
@elheffe7658
@elheffe7658 2 жыл бұрын
Hi! Even though my projectile has its sphere collider box checked in the inspector, its clones spawn in with their sphere collider box unchecked when I shoot. Anyone know why that might be or how to fix it?
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
Did you apply all changes to the prefab?
@elheffe7658
@elheffe7658 2 жыл бұрын
@@davegamedevelopment Yeah that's what fixed it! I realized later that I forgot to change the original prefab. Sorry, I forgot to check back for a reply until now lol. Thanks!!
@bigglasses2625
@bigglasses2625 7 ай бұрын
I can't assign a rigid body, because none exist in the list
@sourdoughbread952
@sourdoughbread952 Жыл бұрын
the explosion just keeps playing! Why?? i did exactly what you did
@chakibchemso
@chakibchemso 3 жыл бұрын
you're awesome!
@rayhan285
@rayhan285 2 жыл бұрын
For those who have problem with the damage Try typing If (enemies[i].GetComponent()) enemies[i].GetComponent().TakeDamage(damage); Also, you need the target script from shooting with raycast from brackeys
@stephenmurya
@stephenmurya 2 жыл бұрын
I've spent close to a month cracking my brain on how to do this. Thank you!
@Maskeowl
@Maskeowl Жыл бұрын
i wana use his code for 2d in 3d space so i have bullet sprite and bullets arent cirqular so i need to rotate tthem allong with aim how i can do that ?
@bloc146
@bloc146 4 жыл бұрын
Awesome!
@Spastic110
@Spastic110 3 жыл бұрын
How can I add recoil where the gun goes back when you shoot
@ElvishGaming1
@ElvishGaming1 4 жыл бұрын
please update this script by adding shooting sound FX
@Dogmut
@Dogmut 4 жыл бұрын
hey! quick question, when i shoot and the bullet explodes, the bullet keeps exploding and doesn't go away? any solution? starts to get very messy after shotting a lot of bullets
@gurdog7731
@gurdog7731 3 жыл бұрын
Same Here :(
@Dogmut
@Dogmut 3 жыл бұрын
@@gurdog7731 if I can remember how I got around to solving the issue, There's a dropdown on the particle system that defines the behaviour when the particles end (can't remember what it's called), you can change to destroy, me and my mate did this I believe, let me know if this helps ! :)
@gurdog7731
@gurdog7731 3 жыл бұрын
@@Dogmut thanks
@ps5games821
@ps5games821 4 жыл бұрын
Please make more tutorials
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
Yes I will :D But also Devlogs of games I make :D
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@davegamedevelopment if ur so good at programming why not make ur game
@derangeddoffy
@derangeddoffy 2 жыл бұрын
I'm getting an error: MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. My muzzleflasheffect also keeps getting cloned in the hierarchy.
@pebble7500
@pebble7500 2 жыл бұрын
I have 5he same problem if you found out why pls tell me
@pebble7500
@pebble7500 2 жыл бұрын
The
@derangeddoffy
@derangeddoffy 2 жыл бұрын
@@pebble7500 I never found out and I quit Unity
@whysl
@whysl 2 жыл бұрын
@@pebble7500 It's because, you drag your bullet from Hierarchy to script, you need to drag your bullet into asset, and from asset to the script Sorry for my English
@pebble7500
@pebble7500 2 жыл бұрын
@@whysl Thanks a lot! Even tho I moved on to roblox studio now, maybe in the future I will come back to unity and use it. So thanks alot!
@LeHalazoone
@LeHalazoone 3 жыл бұрын
Please, can you help me? In my fps game, the player does not shot in the center of the screen in the crosshair. Can you help please?
@LeHalazoone
@LeHalazoone 3 жыл бұрын
@Engloosh i took off the pistol animation white shooting, and i spent some time maninulating the rotation of the gun untill the bullet was into the crosshair. Try that and good luck.
@LeHalazoone
@LeHalazoone 3 жыл бұрын
@Engloosh do you have the script ? Thanks
@self_destruction7603
@self_destruction7603 3 жыл бұрын
I copyd it and thx a lot
@AZASeraph
@AZASeraph 3 жыл бұрын
Why does the recoil move the player and not the gun
@zillionjarl8003
@zillionjarl8003 2 жыл бұрын
Ik I’m very late but the bullets don’t damage objects just bounces them
@firetiredesire
@firetiredesire Жыл бұрын
the spread changes to 0 when i turn 90 percent why is this
@gamerdev1056
@gamerdev1056 3 жыл бұрын
my grenades keep getting destroyed and then I can't use them again :(
@BigWoofer
@BigWoofer 4 жыл бұрын
I've got a couple questions to ask (srry for commenting so much at this point) #1 everytime I fire, the gun uses up 2 bullets rather than 1 even though my bullets per tap is 1 #2 What could cause my spread not to work? I have all the calculation lines in and the bit that adds the calculations to the Vector3 #3 Even though I have a rigidBody on the player, and it's linked to the gun, what could cause it not to recoil properly
@BigWoofer
@BigWoofer 4 жыл бұрын
Figured out 1 right after I commented, sorry about that
@davegamedevelopment
@davegamedevelopment 4 жыл бұрын
@@BigWoofer Maybe download the project file and see how everything is set up there :D (over my discord)
@BigWoofer
@BigWoofer 4 жыл бұрын
@@davegamedevelopment I did, it didnt help unfortunately, I'm sure I'm missing something obvious I'm just not sure what it could be, I ended up switching over to a hit scan weapon temporarily and managed to get spread working on that, still having issues with the recoil though
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
@@BigWoofer just copy the cody (or not coz ur not gona learn anything then)
@tamamlanmamis
@tamamlanmamis 4 жыл бұрын
I have a problem. it doesn't show me the muzzle flash effect when I enter play mode edit: explosion effect doesn't work too edit: ok I found out what was wrong
@lafrek8145
@lafrek8145 4 жыл бұрын
What was wrong??
@atsurao
@atsurao 4 жыл бұрын
tell me how u fixed it plz im having the same problem
@AnonymouseNO.1
@AnonymouseNO.1 Ай бұрын
shooting is broken after attaching bullet script on bullet - speed is weird and soo fast
@emil9080
@emil9080 4 жыл бұрын
Solved Could someone help me Assets\CustomBullet.cs(66,18): error CS0029: Cannot implicitly convert type 'void' to 'bool' the script is (enemies[i].GetComponent().TakeDamage(explosionDamage));
@2koolbros154
@2koolbros154 3 жыл бұрын
U put two Brackets in the end
@everythingbyisaac
@everythingbyisaac 3 жыл бұрын
hi can you make a video on how to kill a enemy on imacet
@CryosBS
@CryosBS 2 жыл бұрын
in enemyAI script: private void OnCollisionEnter(Collision collision) { if (collision.collider.gameObject.CompareTag("Bullet")) TakeDamage(120); } in the inspector create a tag named Bullet and add it to your bullet (set damage to enemy health)
@everythingbyisaac
@everythingbyisaac 2 жыл бұрын
@@CryosBS thanks
@gaminganimator-qp2ir
@gaminganimator-qp2ir 4 жыл бұрын
ok plz do health and damage system tut plz the only thing i need
@sanjayrajasree791
@sanjayrajasree791 4 жыл бұрын
Me too
@iceysnowdragon9163
@iceysnowdragon9163 Жыл бұрын
This script here is not being activated for some reason for (int i = 0; i < enemies.Length; i++) { //Get component of enemy and call Take Damage enemies[i].GetComponent().TakeDamage(explosionDamage); Debug.Log("colliding"); //Add explosion force (if enemy has a rigidbody) if (enemies[i].GetComponent()) enemies[i].GetComponent().AddExplosionForce(explosionForce, transform.position, explosionRange); } So my enemy isn't taking any damage. Is there any problem with this code? Edit: The reason why this wasn't working was because the collider that was set on my enemy was through the floor instead of on the enemy.
@retlyfast4816
@retlyfast4816 Жыл бұрын
For people having trouble with shot bullet and it explode but the explosion did not stop i found some solution 1 uncheck loop (if you are using unity particle pack dont forget to uncheck child too) 2 Under particle system there is stop action button change to destory hope it will useful sorry for my english grammer
@alinatelyk
@alinatelyk 2 жыл бұрын
Your voice sounds extremely familiar 🤔
@davegamedevelopment
@davegamedevelopment 2 жыл бұрын
Haha I know
@L0rdBud
@L0rdBud 4 жыл бұрын
I'm making a shot gun, so it shoot 8 bullets per tap, but they all instantiate at the exact same point and instantly destroy each other(my bullets have a script where they are destroyed when the collide with something)
@zypherone
@zypherone 2 жыл бұрын
My guess is to add a line to the script that offsets the bullets based on its spread value
@catman7474
@catman7474 2 жыл бұрын
did you fix it I have the same problem
@L0rdBud
@L0rdBud 2 жыл бұрын
@@catman7474 i dont remember tbh
@wanbungus
@wanbungus 2 жыл бұрын
i imported the unity particle explosion pack and now my entire project is gone bruh
@whomp3817
@whomp3817 2 жыл бұрын
if you're still interested in this issue, you have to import the settings required, and then if you are using a Unity 3D URP, then you have to go to your package manager and remove PostProcessing
@renatogenovese2718
@renatogenovese2718 4 жыл бұрын
hey dave i'm working on a 2d top down shooter and i'm using your script from the first projectile gun tutorial without reloading,the bulletsleft and the ray. when i do a burst gun instead of firing like RATATA, RATATA, it fires like RATATATA, RA, RATATATA, RA, maybe because it invokes resetshooting also with the burst projectiles. i'm also always shoting when i use the right analog because it moves with the left joystick and rotates with the right joystick. here is my code. can you help me?? using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class player : MonoBehaviour { //general Rigidbody2D rb; //movement public float movespeed; Vector2 movement; public FixedJoystick movejoystick; //rotation public float rotatespeed; public Joystick rotatejoystick; //shooting public GameObject bullet; GameObject bulletshotted; public Transform head; public float bulletspeed; public bool readytoshoot; public float timebeetweenshooting; public guncontainer gun; public int bulletspertap; public int bulletsshot; public float timebtwnshots; public bool allowinvoke; void Update() { //movement float horizontal = movejoystick.Horizontal; float vertical = movejoystick.Vertical; movement.x = horizontal; movement.y = vertical; //rotation Vector3 movevector = (Vector3.up * rotatejoystick.Horizontal + Vector3.left * rotatejoystick.Vertical); if (rotatejoystick.Horizontal != 0 | rotatejoystick.Vertical != 0) { transform.rotation = Quaternion.LookRotation(Vector3.forward, movevector); } //shooting if (rotatejoystick.Horizontal != 0 && readytoshoot || rotatejoystick.Vertical != 0 && readytoshoot) { Shoot(); bulletsshot = 0; } timebeetweenshooting = gun.timebetweenshooting; bulletspertap = gun.bulletspertap; timebtwnshots = gun.timebtwnshots; } void FixedUpdate() { rb.MovePosition(rb.position + movement * movespeed * Time.deltaTime); } public void Shoot() { if (bulletsshot < bulletspertap) Invoke(nameof(Shoot), timebtwnshots); readytoshoot = false; bulletshotted = Instantiate(bullet, head.position, head.rotation); Rigidbody2D bulletrb = bulletshotted.GetComponent(); bulletrb.AddForce(head.up * bulletspeed * Time.deltaTime, ForceMode2D.Impulse); Destroy(bulletshotted, 2); bulletsshot++; if (allowinvoke) { Invoke(nameof(Resetshooting), timebeetweenshooting); allowinvoke = false; } } void Awake() { rb = GetComponent(); readytoshoot = true; bulletsshot = 0; allowinvoke = true; } private void Resetshooting() { readytoshoot = true; allowinvoke = true; } }
@pressstartperlerbeads313
@pressstartperlerbeads313 2 жыл бұрын
The tutorial is great but I can't get my gun to actually damage and destroy objects, can anyone help?
@aaroncrepeele5700
@aaroncrepeele5700 2 жыл бұрын
help i cant download the script the url did not work can you pleace paste the script in the commends?!
@catman7474
@catman7474 2 жыл бұрын
it should work now
SHOOTING with BULLETS + CUSTOM PROJECTILES || Unity 3D Tutorial (#1)
9:25
Dave / GameDevelopment
Рет қаралды 209 М.
FULL PICK UP & DROP SYSTEM for WEAPONS or ITEMS || Unity3d Tutorial
5:45
Dave / GameDevelopment
Рет қаралды 193 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
PERFECT Weapon Aiming! (IK, Unity Tutorial Third Person Shooter)
13:36
FIRST PERSON MOVEMENT in Unity - FPS Controller
23:53
Brackeys
Рет қаралды 3,3 МЛН
Can I 100% Superliminal and Get a Refund?
23:36
Gronf
Рет қаралды 327 М.
Hitscan Guns with Bullet Tracers | Raycast Shooting Unity Tutorial
11:35
COMPLETE Unity Multiplayer Tutorial (Netcode for Game Objects)
1:04:05
Weapon Switching - Unity Tutorial
9:59
Brackeys
Рет қаралды 434 М.
2D Projectiles in Unity - Tutorial
25:19
UnPaws Games
Рет қаралды 6 М.
Flexible LOOT SYSTEM in Unity with Random Drop Rates
13:24
Unity Tutorial - Shoot Projectiles in FPS
19:26
Gabriel Aguiar Prod.
Рет қаралды 82 М.