Simple Shooting | 3D | Bullets | Unity Game Engine

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • Copy code from here-
    u3ds.blogspot....
    Feel free to Like and Share to show support for this channel.
    Don't forget to leave a comment if anything comes to mind.
    Have a nice day :)
    #unity #csharp #tutorial

ความคิดเห็น • 198

  • @666_Man0war
    @666_Man0war ปีที่แล้ว +24

    Lemme explain some of you guys issue with the tutorial.
    1-)A lot of people complaining about bullets hitting something and that object dissappears. Thats because bullet script set like that and you can change that part.
    void OnCollisionEnter(Collision collision)
    {
    Destroy(collision.gameObject);
    Destroy(gameObject);
    }
    2-)Bullets flying up or going to another direction. Thats because gun in the video points different from your gun. You can solve that by changing your BulletSpawnPoint's rotation value depending on your characters rotation.

    • @Frowgster
      @Frowgster ปีที่แล้ว +1

      How would i fix problem number 2?

    • @Glados44
      @Glados44 ปีที่แล้ว

      @@Frowgster if you see in the video he changes the axis XZY on the blue arrow that is the z axis...and rotates on -90 you can change te direction doing this. On the script you instantiate the bullet on this axis and thats why the bullet goes out there. Check those 2 things

    • @EnPoweredNinja
      @EnPoweredNinja 9 หลายเดือนก่อน

      how to fix number 1 when i change the part it doesnt work.

    • @Zifowk
      @Zifowk 8 หลายเดือนก่อน +1

      The reason its destroying everything is because oncollisionentier that means as soon as it hits a collider it destroys it i recommend adding a tag and modifying your script to match the following:
      if (collision.gameObject.CompareTag("Destroyable"))
      {
      Destroy(collision.gameObject);
      Destroy(gameObject);
      }
      You can make the tag whatever you want as long as you change it inside script and inspector

    • @hikkiomori_
      @hikkiomori_ 5 หลายเดือนก่อน

      @@ZifowkBrother can you explain it a bit in depth, please? like I want to destroy an object named Enemy only so what changes do I have to make can you please tell me if you don't mind?

  • @nyours4126
    @nyours4126 ปีที่แล้ว +10

    Short, simple and clear. Good job

  • @smythfamily8321
    @smythfamily8321 ปีที่แล้ว +5

    Thank you so much! I am a noob, and after 1 week of research and trial and error I finally got my gun to work thanks to you!

  • @skarhabekgreyrukh8601
    @skarhabekgreyrukh8601 ปีที่แล้ว +19

    meanwhile some dude have 10 hour tutorial.....

    • @Hecker634
      @Hecker634 ปีที่แล้ว +2

      and i watched it even i am a good game developer but im weak in gunss.. little so i watched a 3hr video and i litterally not learned a single thing. i just can just make a model but this person is a lifesaver

    • @skarhabekgreyrukh8601
      @skarhabekgreyrukh8601 ปีที่แล้ว

      @@Hecker634 those Loong hour video is usually didnt teach you anything beside giving inspiration. Bad tutorial for beginner lol. But for us in the phase of learning, it can show us something new

    • @Hecker634
      @Hecker634 ปีที่แล้ว

      @@skarhabekgreyrukh8601 k...... thx bro

  • @rogersun6184
    @rogersun6184 ปีที่แล้ว +7

    Thank you so much for this, it relieved much frustration for this noob. After I applied this script my bullets worked but destroyed everything they touched, so I modified with a simple if/else so they only kill the objects tagged as Enemy. It doesn't sound like much, but I am feeling very pleased :)

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @LORD---BrazilianSoldier
    @LORD---BrazilianSoldier 2 ปีที่แล้ว +9

    straight to the point, very good tutorial, thank you so much soldier

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @My_In-Ear_Monitor_Fetish
    @My_In-Ear_Monitor_Fetish ปีที่แล้ว +6

    I'd like to be specific with bullets it can be a 5.56, 7.62, 12.7mm, 20mm, 30mm so I made a code for each bullet. The higher the caliber the more powerful the impact
    using System.Collections;
    using UnityEngine;
    public class Bullet : MonoBehaviour
    {
    public float speed = 10f;
    public float maxDistance = 100f;
    public LayerMask collisionMask;
    public ParticleSystem impactParticles;
    public AudioClip impactSound;
    public float destroyDelay = 10f;
    private AudioSource audioSource;
    private Rigidbody rb;
    private void Start()
    {
    rb = GetComponent();
    rb.velocity = transform.forward * speed;
    audioSource = gameObject.AddComponent();
    audioSource.spatialBlend = 1f;
    audioSource.minDistance = 50f;
    audioSource.maxDistance = maxDistance;
    audioSource.playOnAwake = false;
    audioSource.clip = impactSound;
    StartCoroutine(DestroyAfterDelay());
    }
    private void FixedUpdate()
    {
    // Move the bullet using physics forces
    rb.velocity = transform.forward * speed;
    }
    private void OnCollisionEnter(Collision collision)
    {
    // Check if the collision object is in the collision mask
    if (collisionMask == (collisionMask | (1

  • @_EnderTv
    @_EnderTv 2 หลายเดือนก่อน +1

    and this is a good straightforward tutorial video instead of 10 minutes of nonsense

  • @alexplaytop
    @alexplaytop 6 หลายเดือนก่อน +2

    As always GOD mode!

  • @justmonotone
    @justmonotone 2 ปีที่แล้ว +27

    Thanks for making things so simple. Everyone else made it over complicated! I have one question if you wouldn’t mind answering. What if I wanted to spawn different style bullets with different keys? Thanks for your time either way.

    • @Unity3DSchool
      @Unity3DSchool  2 ปีที่แล้ว +17

      Create a prefab for each type of bullet. Then In Gun script, create a GameObject field for each bullet prefab. Now just shoot the desired bullet with desired key.

    • @justmonotone
      @justmonotone 2 ปีที่แล้ว +8

      @@Unity3DSchool perfect! This is exactly what I was going to try and do first!

  • @xestrix420
    @xestrix420 2 ปีที่แล้ว +2

    this is the easiest tutorial to follow ever. and also the most useful one for me :)

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @panachico13
    @panachico13 ปีที่แล้ว +1

    Thank you bro! Works just fine!

  • @Colmezoglu
    @Colmezoglu ปีที่แล้ว +2

    this was the best tutorial that i have ever watched you are really good congrats i am very impressed

    • @Colmezoglu
      @Colmezoglu ปีที่แล้ว

      i agree !

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @jakesparks505
    @jakesparks505 ปีที่แล้ว +1

    It worked for me. Thank you!

  • @Glados44
    @Glados44 ปีที่แล้ว +2

    @Unity3D School do you have a tutorial for damage?
    Im trying to make a damagemanager so i can modify and manage various enemies and weapons and its hard to understand how they correlate with the manager..

  • @alexkarivelil6350
    @alexkarivelil6350 2 หลายเดือนก่อน +2

    How to add a shoot limit plz

  • @vedarovski4110
    @vedarovski4110 2 ปีที่แล้ว +4

    I am making a 2d game and I switched everything with 2d. However, bullet doesn't move. Just spawns without motion.

    • @TheRocketTurtle
      @TheRocketTurtle ปีที่แล้ว

      change the code to instead of rigidbody do rigidbody2d and add a rigidbody2d on the bullet instead

    • @lukemonsterg4819
      @lukemonsterg4819 ปีที่แล้ว

      @@TheRocketTurtle I already was doing that

    • @bfcshadowcore
      @bfcshadowcore ปีที่แล้ว

      I have the same problem did you find the reason why?

  • @ozgungor2339
    @ozgungor2339 2 ปีที่แล้ว +3

    This helped me a lot thank you

  • @boredroars4861
    @boredroars4861 ปีที่แล้ว +1

    thanks so much this was really helpful (im subing)

  • @NishantKashyap-z7q
    @NishantKashyap-z7q 6 หลายเดือนก่อน +1

    Thank you so much. Your video helped me upload my video game today

  • @Chair-ig
    @Chair-ig หลายเดือนก่อน

    Idk why but tbe gun only shoots when i hit space
    I tried fixing by changing things in the scripts but nothing works
    Any tips ?

  • @NoahHayes
    @NoahHayes 6 หลายเดือนก่อน +1

    Great tutorial!

  • @DarkTemplar42
    @DarkTemplar42 2 ปีที่แล้ว +1

    Thanks! I needed something simple and this did the trick!

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @ZenxyYT
    @ZenxyYT 2 หลายเดือนก่อน

    i just realize making fps game in unity are more easier than making in roblox

  • @user-bx9eg5mj2r
    @user-bx9eg5mj2r 5 วันที่ผ่านมา

    How does it have to look like for 2D shooting upwards?

  • @esse_fnc2322
    @esse_fnc2322 2 ปีที่แล้ว +4

    Thank you a lot mate

  • @fallenbored7
    @fallenbored7 2 หลายเดือนก่อน +2

    can someone tell me why my bullets are shooting not cuz of LMB But the Spacebar

    • @Денис-л1ф9п
      @Денис-л1ф9п 17 วันที่ผ่านมา

      u need to change this "if(Input.GetKeyDown(KeyCode.Space))" to this "Input.GetMouseButtonDown(0)"

  • @abdallahtarek2469
    @abdallahtarek2469 ปีที่แล้ว +1

    so perfect tutorial
    thank you so much

  • @aylinetrallers
    @aylinetrallers 10 หลายเดือนก่อน +1

    THANK FOR TUTRIAL IT HELPS ME TO MAKE I OWN GAME

  • @Marzipantuba997
    @Marzipantuba997 9 วันที่ผ่านมา

    How we had texture To bullet ?
    And the gun ?

  • @samuelperez589
    @samuelperez589 2 ปีที่แล้ว +3

    Awesome and simple! Thanks. Do you know how it would be if I would like to fire in bursts?

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @maikseibel5233
    @maikseibel5233 ปีที่แล้ว

    OMG. Desverves a sub. So simple but yet it works

  • @Rawstinski
    @Rawstinski 2 ปีที่แล้ว +2

    Bro I did all but when I press space bar the cylinder disappears and no shooting happens?

    • @DarkTemplar42
      @DarkTemplar42 2 ปีที่แล้ว

      Make sure you attack the destroy script with the bullet not the gun

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @partishdarji26
    @partishdarji26 ปีที่แล้ว +3

    not working!
    it is deleting the gun itself...

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

    • @achrafidou537
      @achrafidou537 หลายเดือนก่อน

      You need to move the bullet spawn point out of the gun
      And rotate it to the other direction

  • @alipourmehdi
    @alipourmehdi 2 ปีที่แล้ว +2

    thanck uoy.

  • @KhaledMohamed-gz7wk
    @KhaledMohamed-gz7wk 5 หลายเดือนก่อน +1

    Thank you very very very much for that

  • @arduinokid8592
    @arduinokid8592 22 วันที่ผ่านมา +1

    thanks

  • @crazycarsim
    @crazycarsim 2 ปีที่แล้ว +2

    make a video on making bullet and particle system and raycast etc

  • @YedidyaHazan
    @YedidyaHazan ปีที่แล้ว

    I don't understand why I have this error: NullReferenceException: Object reference not set to an instance of an object.
    Can you help me?

  • @tr1ppin
    @tr1ppin ปีที่แล้ว +1

    when I press space bar the cylinder disappears and no shooting happens?

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @sniperment5858
    @sniperment5858 ปีที่แล้ว

    thanks for this tutorial. What im struggling with is i want to make the bullets go out as long as i hold the mouse button. My gun is full auto which shoots 750 rpm so id expect the bullets to come out rapidly. Any helps would be appriecated

  • @confusosk8
    @confusosk8 ปีที่แล้ว +1

    THANK YOUUUUUUU!!!!!

  • @Крендель-щ2ц
    @Крендель-щ2ц ปีที่แล้ว

    It just works! Thx!

  • @YihuaLi-u2n
    @YihuaLi-u2n ปีที่แล้ว

    Thanks for such a great tutorial. I am making a game about throwing clothes, but when I replace the bullet ball to cloth it doesn't work.could you help me to figure out why?

  • @asifmehrabi5154
    @asifmehrabi5154 ปีที่แล้ว

    Hello i like the video but when ever i try to the the bullet in the assests it wont let me it gives me an error saying you are trying to save a prefab that has a script and a lot fo other stuff can you please help me?

  • @alexkarivelil6350
    @alexkarivelil6350 2 หลายเดือนก่อน +1

    Wt* the scrip corrupt my camera 😂😢😅

  • @burgersfrompigs
    @burgersfrompigs 2 หลายเดือนก่อน

    my bullet doesn't fire when i press space, but it might be because space is already binded to jump

  • @Fayroll5
    @Fayroll5 8 หลายเดือนก่อน +1

    wow thanks! my gun launched infinite bullets and crashed my unsaved game ive been working on 6 hours from!

  • @T-ogla
    @T-ogla ปีที่แล้ว +1

    ty for show when u script it so i can cppy the script but whrite it myself and understand it more

  • @ElGermanyHitsNukes39
    @ElGermanyHitsNukes39 8 หลายเดือนก่อน

    great tutorial but for some reason when i click space bar the gun and bullet dissapear and nothing shoots... why?

    • @TMP5_xd
      @TMP5_xd 7 หลายเดือนก่อน

      Move the spawner into a position so that the bullet doesn't come into contact with the gun.

  • @benbeyy6914
    @benbeyy6914 2 ปีที่แล้ว +2

    thx for the tuto

  • @nightguaard5917
    @nightguaard5917 ปีที่แล้ว

    It doesnt seem to work for me. In the first script I get an error. "The Local Variable "bullet" can only be used after it is declared"

    • @renesalvacion2452
      @renesalvacion2452 ปีที่แล้ว

      Declared the variable inside the class and not in the function

  • @LUKSvideoclips
    @LUKSvideoclips 2 ปีที่แล้ว

    Perfect, thanks you.

  • @matyash745
    @matyash745 9 หลายเดือนก่อน +1

    My gun is deleted when I press shoot button. What can be a reson?

    • @technicalaniket70
      @technicalaniket70 6 หลายเดือนก่อน

      I think you have written c# script wrong and you used destroygun to destroy the gun on the firing

  • @nickolasmachado9274
    @nickolasmachado9274 ปีที่แล้ว +1

    Thank you

  • @Award0909
    @Award0909 ปีที่แล้ว

    Please help, when i hit play it says invalidOperationExeption this only happens when i enable the script please help :)

  • @egegaripagaoglu6446
    @egegaripagaoglu6446 2 ปีที่แล้ว +1

    What should I do if I want to regularly fire 1 time per second instead of the spacebar?

    • @L9owa_dariba
      @L9owa_dariba ปีที่แล้ว

      make the two line of code to shoot in a method then call it on update method by using Invoke("shotBall", 1f);

    • @L9owa_dariba
      @L9owa_dariba ปีที่แล้ว

      shotBall is a name i give for the method you can replace it with your own method name

  • @cybermichal2237
    @cybermichal2237 ปีที่แล้ว

    this is a very good tutorial. But I have a question how to add sound to shooting

  • @pakavenger5332
    @pakavenger5332 ปีที่แล้ว +1

    HOW TO MAKE IT SO THE BULLET DESTROYS WHEN IT HITS THE OBJECT ?

    • @DaymonKrick
      @DaymonKrick 10 หลายเดือนก่อน +1

      You need to write in bullet script: void update()
      {
      Destroy(gameObject, 3);
      }

  • @rattlehead9902
    @rattlehead9902 ปีที่แล้ว

    How do you attach the gun to the camera so you can aim?

  • @chairchairyes2524
    @chairchairyes2524 2 ปีที่แล้ว +3

    When I shoot, the bullets just go up for some reason
    EDIT: fixed

    • @manavchauhan1449
      @manavchauhan1449 2 ปีที่แล้ว +1

      How did you fix it? When I press space, the gun item disappears

    • @chairchairyes2524
      @chairchairyes2524 2 ปีที่แล้ว

      @@manavchauhan1449 well, i didn’t exactly fix it, I mess around with gravity, but I just had to download the scripts, which was not what I hoped for but as i have hardly any C# knowledge and didn’t know how to fix it, i just downloaded them:(

    • @hustler__mindset
      @hustler__mindset ปีที่แล้ว

      @@chairchairyes2524 what is ur gravity

    • @chairchairyes2524
      @chairchairyes2524 ปีที่แล้ว

      @@hustler__mindset i forgot and my laptop broke so i cant look

    • @hustler__mindset
      @hustler__mindset ปีที่แล้ว

      @@chairchairyes2524 I just switched to raytracing its so much better

  • @Gneey2Smooth
    @Gneey2Smooth ปีที่แล้ว +1

    it trys shooting then out of no where it pops up display 1 no cameras rendering

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      @ollgamgaming Today i gona publish one video for player and a simple map.

  • @BLACKEDSNEPER
    @BLACKEDSNEPER ปีที่แล้ว +1

    this is actually good and easy but one question when the projectile hits the ground then the ground disappears. which is bad for some type of games like fps shooters and others. is there is a way to get over this

    • @Michele-kz4bo
      @Michele-kz4bo ปีที่แล้ว

      yes, after OnCollisionEnter you need to put another "if" in the function (this one is an example, but there are a lot of ways to do this). In that if you need to put if (collision.gameObject.CompareTag("Enemy")) and then leave the two destroy function inside of this.
      Now, in the inspector, you need to assign the tag ("Enemy") to an object, so the system recognise that when the bullet hit that object, before destroying it checks if it's an Enemy.
      Sorry for my english, hope this helps.

    • @قناةصفصوفةالمتنوعة
      @قناةصفصوفةالمتنوعة ปีที่แล้ว +1

      @@Michele-kz4bo thanks bro ive been into this problem, but u helped me

    • @CoustXD
      @CoustXD ปีที่แล้ว

      @@Michele-kz4bo what the fu#k is this

    • @hikkiomori_
      @hikkiomori_ 5 หลายเดือนก่อน

      @@Michele-kz4bocan you send the code with these changes please kind sir?

    • @keithpatience74
      @keithpatience74 5 หลายเดือนก่อน

      @@hikkiomori_ using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class Bullet : MonoBehaviour
      {
      public float life = 3;
      void Awake()
      {
      Destroy(gameObject, life);
      }
      void OnCollisionEnter(Collision collision)
      {
      if (collision.gameObject.CompareTag("Enemy"))
      Destroy(collision.gameObject);
      Destroy(gameObject);
      }
      }

  • @mohanedmohamed6155
    @mohanedmohamed6155 5 หลายเดือนก่อน

    How to make it with Ui button?

  • @zedch96
    @zedch96 ปีที่แล้ว

    How to make your bullet stop going down Rigidbody Gravity is off idk what is happening

  • @FuS1oNDaBest
    @FuS1oNDaBest ปีที่แล้ว +1

    My whole gun dissappears after I shoot once , can you help me?

    • @doublebigmackc
      @doublebigmackc ปีที่แล้ว +1

      dont put the BulletSpawnPosition in the gun put it in the gun tip so it doesnt spawn in the gun and destroy it

    • @FuS1oNDaBest
      @FuS1oNDaBest ปีที่แล้ว

      @@doublebigmackc I did put it in the tip but il try moving it a bit more forward

    • @doublebigmackc
      @doublebigmackc ปีที่แล้ว +1

      @@FuS1oNDaBest yeah but dont put it in the gun hitbox or collider

  • @andimirnawati2609
    @andimirnawati2609 ปีที่แล้ว

    what if the script method is changed to a button?

  • @reshmadevikijai5630
    @reshmadevikijai5630 ปีที่แล้ว

    while moving character, if i press left key and forward key at same time, then space doesnt work

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @completoastral6416
    @completoastral6416 ปีที่แล้ว

    how do i make the bullets dissapear if they hit something im tring to make a death whit a ragdoll and i want the bullet to destroy if they hit the enemy pls help

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @m1dnight2.0
    @m1dnight2.0 ปีที่แล้ว

    i got an error InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
    UnityEngine.Input.GetKeyDown (UnityEngine.KeyCode key) (at :0)
    Gun.Update () (at Assets/Scripts/Gun.cs:13)

  • @Zucth
    @Zucth ปีที่แล้ว

    How did the bullet destroy itself?

  • @scrublorddoesgamedevstuff
    @scrublorddoesgamedevstuff ปีที่แล้ว

    thank you so so much for this i kept getting compiler errors

  • @konigaminggr
    @konigaminggr 10 หลายเดือนก่อน

    for some reason my bullet doesnt move when spawned

    • @konigaminggr
      @konigaminggr 10 หลายเดือนก่อน

      nvm i fixed it by adjusting the rigidbody a bit

  • @Kurtiz-1
    @Kurtiz-1 หลายเดือนก่อน

    Yo can I get some help? the bullet shoots but it keeps going to the side

    • @Chair-ig
      @Chair-ig หลายเดือนก่อน

      Try rotating the gun until u get the angle where it shoots forward
      Or add a different part , make it small, call it Gun and put it inside the previous gun itself , and rotate it until it shoots forward

    • @Kurtiz-1
      @Kurtiz-1 หลายเดือนก่อน

      @@Chair-ig I just had to rotate the bullet thx tho

  • @lazikbro12
    @lazikbro12 2 ปีที่แล้ว +1

    bullet dont destroy obstacles

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

  • @cekconi1773
    @cekconi1773 2 ปีที่แล้ว

    👍👍👍

  • @Razberry13.1
    @Razberry13.1 ปีที่แล้ว

    how to make a shoot cooldown?

  • @utbay6493
    @utbay6493 6 หลายเดือนก่อน

    how can you call urself Unity3D School and u just dont explain and just let us copying it

  • @RaunakGameDeveloper
    @RaunakGameDeveloper ปีที่แล้ว

    Thanks bro

  • @remixr-i6m
    @remixr-i6m 10 หลายเดือนก่อน

    The bullet is too small, how can I solve this?

    • @SGUDevs
      @SGUDevs 9 หลายเดือนก่อน

      resize in prefab editor

    • @remixr-i6m
      @remixr-i6m 9 หลายเดือนก่อน

      thx

  • @fyit8-kishanbind422
    @fyit8-kishanbind422 6 หลายเดือนก่อน

    why my code is not working even if i copied your code

    • @AxolotelGod
      @AxolotelGod 3 หลายเดือนก่อน

      I'm looking for the answer to

  • @Fort3x7
    @Fort3x7 8 หลายเดือนก่อน

    that beat go hard!!!!!!!!!!!!!
    🔥🔥

  • @SirHotDogManTheFirst
    @SirHotDogManTheFirst ปีที่แล้ว

    my gun breaks the ground when I shoot, can you tell me how to fix that? thank you.

  • @Hen_VR
    @Hen_VR 2 ปีที่แล้ว

    thx alot bro

  • @wassezmaingkgaming9027
    @wassezmaingkgaming9027 2 ปีที่แล้ว

    i can't use ur script it says the associated scrpit can not be loaded pls help

    • @Unity3DSchool
      @Unity3DSchool  2 ปีที่แล้ว +1

      This happens when there is compiler error in script. Recheck the script mentioned in the error message.

  • @BooztedMedia
    @BooztedMedia 2 ปีที่แล้ว

    how do i make so when a bullet hits the ground it doesnt delete it?

    • @shlomohalev8122
      @shlomohalev8122 2 ปีที่แล้ว

      use tags/layers

    • @adikh223
      @adikh223 2 ปีที่แล้ว

      @@shlomohalev8122 Can you explain more? Am I supposed to change the script? If so what lines and what do I change them to?

    • @shlomohalev8122
      @shlomohalev8122 2 ปีที่แล้ว

      @@adikh223 you can mark the ground with ground tag and then when the bullets hits the somthing destroy the bullet only if the bullet not collide with this ground tag

    • @SirHotDogManTheFirst
      @SirHotDogManTheFirst ปีที่แล้ว

      if you ever figured this out please tell me how

    • @scrublorddoesgamedevstuff
      @scrublorddoesgamedevstuff ปีที่แล้ว

      @@SirHotDogManTheFirst Put the bullet and the objects on the same layer

  • @antclaDev
    @antclaDev ปีที่แล้ว

    thank you 😁😁😁😁 you help if it dont work. click space

  • @inzot5198
    @inzot5198 ปีที่แล้ว

    is there a way i can make it left click instead of space bar

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

    • @bbproductions8975
      @bbproductions8975 ปีที่แล้ว

      Input.GetMouseButtonDown(0) means get LMB

    • @doublebigmackc
      @doublebigmackc ปีที่แล้ว

      @@bbproductions8975 1 for rmb right?

    • @ALFAA06
      @ALFAA06 ปีที่แล้ว

      @@doublebigmackc yes and 2 for middle mouse button (scroll)

    • @doublebigmackc
      @doublebigmackc ปีที่แล้ว

      @@ALFAA06 nope 2 is for lmb and 3 is for scroll

  • @gamingwithvihu8888
    @gamingwithvihu8888 ปีที่แล้ว

    Yo can you help the bullets won’t appear

    • @olivedunphy
      @olivedunphy 5 หลายเดือนก่อน

      Me too ~ I'm stuck on this part , my bullet doesn't show

  • @yvngdidas
    @yvngdidas 10 หลายเดือนก่อน

    for me it doesent work

    • @yvngdidas
      @yvngdidas 10 หลายเดือนก่อน

      ok now i realised that it was the key space to shoot, nice tutorial

  • @nrfx_thrinyxt
    @nrfx_thrinyxt 2 ปีที่แล้ว

    hi thanks a lot!😁 but how can i shot with the gun?

  • @TheRealBearclip
    @TheRealBearclip ปีที่แล้ว

    Great vid worked fine but when I restarted Unity bullets/balls fell to the ground and didn't go anywhere else, anyone know how to fix it?

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว +1

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

    • @shalev2323x
      @shalev2323x ปีที่แล้ว

      you just need to set the rigidbody of the bullet on no gravity

    • @TheRealBearclip
      @TheRealBearclip ปีที่แล้ว

      @@shalev2323x hi thanks for helping but it fixed its self after i restarted unity again thank and merry christmas

    • @TheRealBearclip
      @TheRealBearclip ปีที่แล้ว

      @@unitytutorialsfree will do 😆

  • @ivySharp-b2h
    @ivySharp-b2h ปีที่แล้ว

    it makes me jup to

  • @Sobiikk
    @Sobiikk หลายเดือนก่อน

    Не работает

  • @justdev350
    @justdev350 2 ปีที่แล้ว

    how to make it to mouse

    • @R3alitysh1ft
      @R3alitysh1ft ปีที่แล้ว +1

      use this code for the left mouse button
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class Gun : MonoBehaviour
      {
      public Transform bulletSpawnPoint;
      public GameObject bulletPrefab;
      public float bulletSpeed = 10;
      private void Update()
      {
      if (Input.GetKeyDown(KeyCode.Mouse0))
      {
      var bullet = Instantiate(bulletPrefab, bulletSpawnPoint.position, bulletSpawnPoint.rotation);
      bullet.GetComponent().velocity = bulletSpawnPoint.forward * bulletSpeed;
      }
      }
      }

  • @SqualidsargeStudios
    @SqualidsargeStudios 10 หลายเดือนก่อน

    first of all, annoying background "music" and second those clicks are even more annoying. and too LOUD!!! other then that. there might be some useful "info" in it

    • @r3act4nt
      @r3act4nt 27 วันที่ผ่านมา

      maybe if you focus on the content more then you would find it less annoying

    • @r3act4nt
      @r3act4nt 27 วันที่ผ่านมา

      i personally didn't find it annoying at all because I was trying to implement this shooting for weeks and there was always some flaw and everytime I searched for answers there were 2 3 hours videos

    • @r3act4nt
      @r3act4nt 27 วันที่ผ่านมา

      which didn't even solve my problem and then I found this

  • @WARPEDGOON
    @WARPEDGOON 2 ปีที่แล้ว

    Doesn't work

    • @unitytutorialsfree
      @unitytutorialsfree ปีที่แล้ว

      tomorrow i gona make tutorial for the gunshot and enemy subscribe to see it.

    • @bencebob8055
      @bencebob8055 ปีที่แล้ว

      works on my machine

  • @simonblitzway
    @simonblitzway ปีที่แล้ว +9

    heres the code if you wanna use lmb:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Gun : MonoBehaviour
    {
    public Transform bulletSpawnPoint;
    public GameObject bulletPrefab;
    public float bulletSpeed = 10;

    void Update()
    {
    if(Input.GetMouseButtonDown(0))
    {
    var bullet = Instantiate(bulletPrefab, bulletSpawnPoint.position, bulletSpawnPoint.rotation);
    bullet.GetComponent().velocity = bulletSpawnPoint.forward * bulletSpeed;
    }
    }
    }

  • @zMego
    @zMego 2 ปีที่แล้ว +1

    Hello I really need help how i can contact you hope you respone fast ! .

  • @_ches0_
    @_ches0_ 7 หลายเดือนก่อน +1

    Thank you bro!