Shooting, Simple Spread, and Bullet Trails in a ScriptableObject-Based Gun System | Unity Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ม.ค. 2025

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

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

    Some of this I have implemented myself, but never before with Scriptable Objects, which sounds like will allow for much more customizability and expandability. Excited for this series!

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

    One of the best things about your tutorials is finding out about new/old things that I never even knew about in all my time of using unity. (case in point, native unity Object Pools?!?!?!?! This is so cool!!!)

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

    This an amazing weapon system, it'll be an amazing starting point to add more advanced stuff like gravity or bouncing

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

      Thanks 🙏! Gravity will come with projectile-based weapons in the future. I covered bouncing bullets before here:
      th-cam.com/video/GkStW8-Q5P0/w-d-xo.html
      I wasn’t planning to cover it in here, but that’s an interesting idea to consider to have it all in one place.

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

      @@LlamAcademy my goal is to add gravity to the raycast, I mean a noob I'll learn a lot if i do it

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

      You can do that, but usually bullets have relatively low mass and high velocity which makes the normal hitscan ray cast “good enough” of a simulation. If you really want to add it, you can follow the concept of this video: th-cam.com/video/8mGZBYsSXcQ/w-d-xo.html and it will give you the result you’re looking for.

  • @jaulloa21
    @jaulloa21 8 หลายเดือนก่อน +4

    I like how this complex system is organized for a noob that would be frustrated otherwise

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

    Bro, i'm tryna make an fps game, and I haven't been able to find a good video for this kind of stuff for weeks. You, my dear friend, are a god send

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

    You only got 22k subscriber, yes I said ONLY because for tutorials of such quality it's not that much! Keep going!

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

      🧡thank you! I appreciate that!

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

    Hell yeah. This is amazing :D
    Once the series is over, something similar for an ability system (think League of Legends for example) would be sick. I've been doing some research lately and there isn't much valuable content about it. Maybe it's a good challenge and opportunity
    Anyways, thanks for your awesome work!

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

      ❤️!
      That’s a great idea! I have a real life use case for that, so maybe once I get some time to play with it and see the challenges I can put together a series on it!

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

    Thanks man! The create tail and render trail funcion and the variabels was very useful for creating the perfect trail. It's always better controlling it with the code. Learnt alot and I could now use this in my own game to create good looking bullets.
    Thanks!!!!!!

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

    Great content as usual! Looking forward the next videos on this serie! :)

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

      Thanks 🙏 I am too 🙂

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

    So looking forward to this series !!!

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

      Me too 😁! This is one topic area I feel is underserved and needed!

  • @K.Z007
    @K.Z007 ปีที่แล้ว +1

    Great, what a brilliant brain you have to create such sophisticated system and you been so kind to share with us. Thank you a lot mate. You are amazing.

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

      Wow thank you for that! It made me smile 😊

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

    so helpful man, thanks for showing the older system too

  • @lv1543
    @lv1543 10 วันที่ผ่านมา

    i have absolutely no idea whats going on but i will push forward.

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

    ive not even finished this series yet and i know its gon be good (everything i need for fps)

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

    For those of you wanting to use this for an FPS, configure the player camera to be the raycast start point, from what I've heard making the camera the start point fixes a lot of inconsistencies with aiming

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

      Could you, please, explain how to do it?

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

      @@jesse_belkman too late probs but just switch the camera to that thing

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

    Great stuff as always!

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

      Much appreciated 🙏

  • @ضله-ث8ط
    @ضله-ث8ط 2 ปีที่แล้ว +1

    you are awesome ,please keep the brilliant work❤❤

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

    Broooo you made my hand and fingers pain by writing that much code for the first time 😅

  • @ChadGatling
    @ChadGatling ปีที่แล้ว +25

    You need to stop doing everything uprfront. It is soo hard to figure out what is actually happening when you just spend 10 mins rattling off a bunch of code. Make it by following the logic of the functionality instead of setup then implementation. Start with a basic implementation and then add complexity on top of that. You might as well just have people download the files because this isn't really teaching the concepts from the ground up it is just rote memorization of how to do a very specific type of thing.

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

    Thanks for this dude!

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

    Hi, I am trying to follow this great tutorial, but at 11:34 you use (SurfaceManager) and it is showing up as an error for me. I do not know where in the video this class was created, hope you can get back to me on this. :)

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

      Please see pinned comment

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

    Wouldn't the GunType enum prevent you from updating the game over-the-air (like you mentioned in 1:50)? Adding a new gun type would require you to update the code and thus require a new build. Since you're using it as a unique identifier, a string or integer might be a better fit. Just need to remind the designer to make the identifiers unique (or write an editor script to automatically fix them).
    Otherwise pretty great tutorial. Straight to the point and very little to no fluff.

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

      Yes you are correct! In the final section I discuss ways to solve that problem. Specifically, I talk about how you could use the "Name" parameter on the GunScriptableObject to match against in place of GunType.
      Edit for some more context:
      For most developers, that's not going to be within the scope of what they'll implement. Typically I don't like "magic strings" that have significant meaning, so I implemented the GunType to have a declarative way to match the guns for the majority of users, and in the end of the video I talk about how you can support the over the air updates by using the Name as a "magic string"

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

      @@LlamAcademy Alright I missed that part.
      The real solution to avoid magic strings would be to have an editor tool that automatically populates the identifiers with Guid or something similar but that's way out of this video's scope.
      Might be an interesting topic in the future though. I feel like editor scripting in general is not discussed a lot.

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

    tryed to put bullet prefab in but it wont let me

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

      help

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

      Did you assign the bullet script to your prefab?

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

    11:38 I don’t have the surface manager nor the impact type

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

      Hi. There’s several comments around this one. In this video I DO NOT cover the Impact System: th-cam.com/video/kT2ZxjMuT_4/w-d-xo.html you can check out that video for the full explanation for how that works.
      In there we create the SurfaceManager and ImpactType. If you don’t care yet about impact effects, you can safely skip those and you will still be fine 💪

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

      @@LlamAcademy yeah just saw that😅 great vid very good system

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

    Hey Chris, how do you plan these Systems? This Guide is honestly pretty damn good. Do you just start by coding some of the ideas until you have a working prototype or do you plan these systems upfront and if so got any tips on how to design systems?

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

      My planning for systems is probably not the ideal model.
      I typically think about things for...between seconds to minutes then get started working on it from basically just the "idea". Usually it works out okay, but there are some holes or problems that I refactor as I run into the limitations of whatever the initial design was.
      For this system I had already done that full process of design, implementing, & refactoring in my old (now unpublished) mobile game Llama Survival. I had already identified a bunch of the problems & solutions that I couldn't or wouldn't solve in the first implementation for that game, and that was the starting point for this tutorial series.
      I think what works best for you really depends on whether you like to plan all the details out ahead of time, or you like to just get into the weeds and figure it out. The latter has a higher risk of rework and the first iteration usually has some problems. I just like to just get started on things 😅. That's more rewarding for me than spending a ton of time on the initial design.

    • @GTZ-98
      @GTZ-98 2 หลายเดือนก่อน

      ​@@LlamAcademy Thanks for the insights.
      Yeah what I've found to be working quite good is a mix of both. Just thinking about what I need on a high level and then get right to work. When I feel like I'm stuck I iterate on my design and try to fix things on paper before I code again. When I just code before having a high level overview that's usually when shit starts to blow up for me 😅

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

    I have a question. Maybe someone can help me. But first a big thank you for the great tutorial! The raycast is performed at the beginning of the shot. How is it supposed to catch an moving object like an enemy which is at that point not in line with the raycast?

    • @LlamAcademy
      @LlamAcademy  24 วันที่ผ่านมา

      When using a Raycast you perform all the hit detection on the frame you click, everything after that is just VFX that happens after the fact to show the player something is happening :) If you shot them where they were that frame, it should all be good. If not, then you missed!

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

    The "ParticleSystem" named "ShootSystem", what is it? is it a particle system nested somewhere on the gun prefab? is it for the muzzle flash?
    Could you please point me to the video that explains the muzzle flashes and/or the "ShootSystem"?
    Thanks in advance for the information.

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

      Found a brief mention of this here:
      th-cam.com/video/cI3E7_f74MA/w-d-xo.html if anyone is interested...

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

      Hey! The ParticleSystem named ShootSystem is gathered at the time of spawning the gun into the world. I set it up in the code around time 6:20. Around 16:25 I talk about the prefab configuration of the glock and m4. I didn't talk too much about the positioning of it, but you should place it where you want the bullets to spawn, so close to the tip of the muzzle. The assumption here is the muzzle flash and the bullet spawn point can be the same place
      In your other comment, in that video we drag references in the Inspector, which I tried to avoid here, instead I'm opting to pick it up automatically on Spawn.

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

      @@LlamAcademy I downloaded your github repo and opened it in the same unity version. Looks like the MuzzleFlash01 is having issues (missing Prefab with guid: numbers-blah-blah. Sadly it keeps me from trying out your system :( ... Thanks for the tuts though, very nice!

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

      @@jeremywieland714 Did you import the Unity Particle Pack after checking out the GitHub?

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

      @@LlamAcademy That was it thanks!

  • @legendsmb-pw6mv
    @legendsmb-pw6mv ปีที่แล้ว +2

    In GunScriptableObject.cs, why is the TriangleIndex set to 0 directly in the following line?
    SurfaceManager.Instance.HandleImpact(
    HitCollider.gameObject,
    HitLocation,
    HitNormal,
    ImpactType,
    0
    );
    Won't this result in incorrect impact results if there are multiple submeshes?

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

    Amazing! | Just asking if you have any tutorial to zoom in with the gun? If you do please reply to me.

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

      I do not but that is on my list for this series

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

    I couldn't finish my code relying this turorial, but thanks, it's really cool video. I faced mistake when I tried make ObjectPool(CreateTrail) - now we need to provide a second argument "actionOnRelease". I can approximately imagine how to do it, but anyway it's a bit complicated to me).

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

      Hmm... the 2021 Object Pooling system should not require you provide the secondary argument. If you want to understand more about the 2021 Object Pooling system you can check out my full tutorial on that: th-cam.com/video/zyzqA_CPz2E/w-d-xo.html
      For any shooting system, I highly recommend using an Object Pool to eliminate garbage and keep your game running smoothly

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

      @@LlamAcademy Thank you for your answer! I know that I need to dig deeper. I'll definitely check it out to fully understand this topic.

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

    Great series. Learning a lot about scriptable objects. I do have one question however. In the repository there are a number of "Editor" scripts that aren't explained in the video and it appears the SO scripts won't function without them?
    thx

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

      You do not NEED any of the editor scripts for them to work, but they make it easier, faster, and more convenient to set stuff up. How the custom inspectors are done are covered in these: th-cam.com/video/3w9iXT6wx5g/w-d-xo.html & th-cam.com/video/moXvNj7QUHE/w-d-xo.html
      Each video in this series has its own branch in the github repository so if you want to see just what was done in video 1, check out branch "part-1"

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

    hey amazing video and i have followed but i have a problem, when i click "create

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

      Usually that’s because the gun scriptable object was not converted from “: MonoBehaviour” to “: ScriptableObject” or the [CreateAssetMenu] tag is missing, or improperly defined (such as copy/paste issue with multiple SO with the same path)

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

      @@LlamAcademy i did everything correct as you said but still doesnt work i grabbed the code from your github so its copy pasted, i dont know what to do now, if you are ok on communicating on discord so i can show you a picture of the error. it would be the easiest method.

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

      Okay. Send me a message llamasoftware#5070

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

      @@LlamAcademy Hi, what was the issue on this one?

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

      oh, found it.

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

    Very Modularity, I like it.😂

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

    Awsome but were I find the tutoria to make the StarterAsset as a Third Person Shooter? 😅😅

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

    Hi great tuturial ! which part do you show how to set up the IK script or do you have a seperate tuturial🙂

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

      I do not have the IK tutorial yet, but you can check out the project from GitHub and review this implementation as a quick and dirty get started point!

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

      @@LlamAcademy Brilliant thank you very much 🙂

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

    What just happend. 😭Im learning C# for about under a year now ... what must i do to become so heckin' good like you! Im amazed, honestly.

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

      😅 thank you for the compliment. Just keep working, practicing, and learning. You will get better!

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

    21:00 so my question here is, I've tried putting assets in the Resources Folder before, and then created a folder hierarchy within it, and couldn't reach the hierarchy. What do I need to do to reach the hierarchy or is that what addressable resolves? This is effectively my second week in Unity and I am trying to learn C# principles as well as how Unity functions, so forgive me if this question is obvious, or incomplete.

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

      For resources folder you can load with the path name to the file without “Resources”. Resources are bundled on build, so if you include everything there, you can easily reference them. Addressables allow you to extend the game without needing to rebuild the whole game.

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

      @@LlamAcademy awesome, I saw some videos, that were not beginner level, and it seemed like that was the next step in my programming journey after the basics! Thanks for confirming that!

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

    I also still have playtrail does not exist in the current context should that still be there

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

    Does the weapon work well for FPS? Or adjustments have to be made. Thanks for making such a complete tutorial.

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

      Yeah it should work for FPS. I saw a few people are using it in FPS scenarios successfully

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

    this work well can we do this for mele combat swords and hand

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

    can some one help me?
    in 11:30 he use SurfaceManager by mine script dont work

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

      The SurfaceManager is done in another video, linked in description. You can skip that if you do not need impact effects at this time.

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

    Hey @LlamAcademy I was hoping to get the github version of this project working, as it was awesome to see it graciously provided and I was looking to compare my current system which has been built upon from your previous tutorials. I just had one problem, it doesn't seem to be explained how I go about importing Unity Particle Pack into the project without destroying the settings. Also awesome production quality on these videos B)

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

      Hi! Great question, and a common one. The Unity particle pack can be imported without overriding settings if you deselect all of the project settings files (they’re like the last ones). If you only select the folder about Effect Examples you will only get the particle systems, materials, and textures

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

      @@LlamAcademy Thanks for the quick reply! Got it working great now as long as the hilarious aiming isn't caused by me, I could see this whole looking down+aim bull in a china shop movement mode working quite well if implemented as a feature XD CHARRRGE hahaga. As it's a common question it could be nice to have a quick explanation added to the github's "Quickstart", including updating materials. Looking forward to seeing how far this series goes!

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

      😁 the movement and aiming is not particularly well implemented. It was a quick hack job just to get something there while we implemented the core “gun functionality”. Coming soon - accurate crosshairs! Movement still will be crazy while aiming but the aim will be right.
      Sorry! I meant to say as well, I will update the readme with that info!

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

    Genius!!! 🧐

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

    Do you have a weapon manager video? I don't think there exists one on youtube. For choosing and equiping a weapon before the match starts, or as we spawn like in Valorant.

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

      I’m thinking that in this series I may cover some kind of gun selector!

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

    Hi! thank you for this tutorial. I'm a newbie in unity coding so I followed each script closely but somehow still cant get the create -> guns menu show up on my end. I tried looking at the scripts from your github but it seems it's a more refined version of the scripts for later part of this tutorial series.. There's an error log saying "failed to find entry-points" with long logs under it (which I don't understand) If anyone encounter the same problem or have an idea on its solution, please help ;-;
    Update: I solved it but I have a question about the PlayerIK script as it won't show up on the inspector and gives error logs... please help ;-;

  • @JeebZ-3D
    @JeebZ-3D 9 หลายเดือนก่อน

    Awesome tutorial! Quick question, I've used the system for a RTS game, but I can't seem to figure out why does the duplicated unit detects an enemy, the original shoots. Any thoughts? Thanks in advance!

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

      Sounds like maybe the ScriptableObjects aren't cloned properly and all are using the original?

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

    Awesome video! Just wish explanation would be little bit slower. My brain had to switch to second gear to keep with the pace of video. Other than that great job!

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

      It's always a fine line to walk between "too fast" and "quit droning on and on". I'm generally a fast paced person so I guess it comes through in the videos sometimes 😅

  • @友贤
    @友贤 ปีที่แล้ว

    Hi! I would like to say that this series of tutorials has been very well done and very helpful. And I have a question which is when I implemented this gun system into my project, I found that the trails that shoot out are biased to move upwards and look a bit unnatural in first-person view, is there any way to modify it to make the trail become more straight or fall slowly?

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

      The spread is based on your defined Vector3 (Simple) or Texture. If you feel the "upward spread" is too much, you can play with whichever option you have to lower the variance in that direction.
      Usually a gun does recoil up, so I would expect that to be one of the primary ways it does recoil 🤔

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

    I have an issue when im firing the trail is instantiation from the ground

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

      Make sure you have the particle system at the tip of the gun and when you are spawning the bullet to set the spawn point to be at the same point!

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

      @@LlamAcademy yea thanks I fixed

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

    Are you using the Unity Third person controller along side this?

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

      Yes that is the base for the movement and the model

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

    wb knife throwing projectile?

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

      You could probably handle that here as well with a low rate of fire and customized animation. Projectiles are covered in Part 6 of this series!

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

    How can I application quit in build I know the editorial application quit application.quit() in build not working

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

    What do i do to get the surface manager?

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

      You can check it out from this project or the dedicated Surface Manager github. Those are all linked in the description.

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

      ok thanks@@LlamAcademy

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

    beam trails will work with this type of system or will it need additional programming?

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

      Depends on how you want to do the beam I suppose

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

    Thank you for the video! Small bit of feedback the music is a tad loud and it makes it harder to understand you. If anything I'd prefer no music, especially any time there's an editor open. I've had to rewind a good bit 😅

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

      Thank you for the feedback, I thought I had it at a low enough volume to not be distracting but apparently not! I will keep that in mind in the future.

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

      @@LlamAcademy Appreciate you hearing me out!

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

    Hey what is this SurfaceManager ? I dont have that ..

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

      It's how we manage impact effects. That was covered in a separate video and has a dedicated github repo. More details in description and the pinned comment.

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

    Hey! This tutorial looks great, but when I download it from Github, it keeps giving me errors. I think the issue is with the MuzzleFlash particle system in the gun previews

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

      Did you import the Unity Particle Pack after cloning from GitHub?

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

      @@LlamAcademy Yeah, but they don't work with URP
      Edit: the render pipeline converter solves the issue

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

      @bbrainstormer2036 awesome to hear!

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

    the problem i am having is i am having a virtual camera that follows character positioned at characters back....show only characterss back portion will show now during swipe code of look functionality of starter asset its rotating in every angle so may characters side and front portion is visisble ...is it possible that any swiping character also rotate on camera direction...so only back portion of character will be seen..please help

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

    Can i transform this to use it for a doom clone game?

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

      I don’t see why not 🙂

  • @Chris-yq1fw
    @Chris-yq1fw หลายเดือนก่อน

    Hi, I think the system is not that extensible, the gunSO would not work as expected because only one of its kind is allowed to spawned in the scene, what if your enemies also have that same gunSO ?

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

      We are cloning the SO so each individual user of a gun has their own instance of a gunSO that can be configured as needed

    • @Chris-yq1fw
      @Chris-yq1fw หลายเดือนก่อน

      ​@@LlamAcademy Hi Chris, thanks for your answer, just to clarify, to clone the SO we have to change from this
      - gunSO = guns.find(...);
      - gunSO.Spawn(...)
      to this ?
      - gunSO = guns.find(...);
      - newGunSO = Instantitate(gunSO)
      - newGunSO.Spawn(....)

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

      Sorry. I don't think in this video we got into cloning the SOs in this video. Yes, you will need to do something like that.
      I don't remember the exact video but later on in this series we get into that, probably when we get into modifiers/attachments.

    • @Chris-yq1fw
      @Chris-yq1fw หลายเดือนก่อน

      @@LlamAcademy Many thanks, good day!

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

    Anybody else having some trouble with "The type or namespace name 'PlayerIK' & 'ImpactType' & 'SurfaceManager' could not be found"?

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

      Yes. Please see pinned comment

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

    I want to do this with netCode... I didn't find anything about it...

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

      There's generally 2 approaches with networked games:
      1 do the Raycast on the server based on server-synchronized positions of players / guns and send an RPC/message to clients that the shot was fired from point X to point Y and have the clients only handle the rendering.
      2 do the raycast on the client and send a message to the server that it hit something and have the server validate if that's reasonable (that's the hard part 😉- you can skip this but it makes it really easy to cheat).
      #1 is harder to cheat with, #2 "favors the shooter" which can feel more responsive.

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

      @@LlamAcademy grateful

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

    does anyone know how to fix surfacemanager error ? , it would really helpfull

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

      Please check pinned comment

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

    trails is creating nicely but they are created far from pistol,,,,not from the pistol...is there any solution?

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

      Are you assigning their start position to the gun particle system as soon as you spawn them?

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

    In the GunSo you have ImpactType and SurfaceManager, which appear to not be a part of the unity engine. where did you make those or get those classes/objects from?
    Same with PlayerIK in PlayerGunSelector

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

      👋 Hi! PlayerGunSelector we implemented in this video. When I talk about SurfaceManager / ImpactType I mentioned it was covered in another video (that’s linked in the description). The full project is on GitHub so you can view all those files. A better version of the PlayerIK will be done in a future video. As I said, It was really just for the demo to look nicer with the hands actually on the gun

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

      I don't think that you're going to see this, but if you did, how did you fix this?

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

      @@joaodias8824 sadly I never fixed it

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

      @@kamron4825 if I figure it out I'll let you know

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

      Hello. As I said above you can find the SurfaceManager and ImpactType on the GitHub github.com/llamacademy/scriptable-object-based-guns/tree/main/Assets/Scripts/Surface%20Manager
      If you would like to understand how those are created, you can check out the associated tutorial: th-cam.com/video/kT2ZxjMuT_4/w-d-xo.html
      These can be completely skipped and ignored if you do not want to use that impact system without any additional loss in functionality.
      PlayerIK is also in the repository: github.com/llamacademy/scriptable-object-based-guns/blob/main/Assets/Scripts/PlayerIK.cs, but again I don’t recommend relying on this because I just quickly put it together without much thought. Later in the series we’ll probably review a better implementation.
      In this video I covered PlayerGunSelector at 13:00. You can always check the chapters at the bottom of the video to see each section.

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

    Does this project differentiate which kind of interaction to use for which weapon? Like how a glock is semi, an m4 is automatic, a laser gun is charge/release

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

      Not really. The gun system supports any of these, but the player interaction with the gun system is left to the implementer. If you would like these “fire mode”s I’d recommend to add that to the ShootConfigSO and read it on your “PlayerInput” and use that to determine if the gun.tick() should be called

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

    I don't know how to fix that problem... Can anybody help?
    GunScriptableObject.cs(9,9): error CS0246: The type or namespace name 'ImpactType' could not be found (are you missing a using directive or an assembly reference?)
    PlayerGunSelector.cs(16,10): error CS0246: The type or namespace name 'PlayerIK' could not be found (are you missing a using directive or an assembly reference?)

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

      Hi 👋. The impact system won’t be covered in this series because it was covered in this video: th-cam.com/video/kT2ZxjMuT_4/w-d-xo.html The full projects for all my videos are available on GitHub, so you can download those scripts from here: github.com/llamacademy/scriptable-object-based-guns (links also in description). Since this video is part 1 only, you may change the branch to “part-1” to only see what you see here.
      Good luck!

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

    Having 'LastShootTime' in the SO itself, won't that cause problems when there are multiple instances of 'PlayerGunSelector'?
    For eg:- Let's say we use this system to equip enemies with weapons and there are multiple enemies with M4, but there is only on 'GunScriptableObject' of M4. Won't changing the 'LastShootTime' for one enemy change it for all enemies?
    or even in a multiplayer scenario, won't it cause a problem?

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

      Good question. In this video we didn't get into solving that problem, but you are right you will need to clone the SO or create instances to be used at runtime. Later on in the series we tackle that.

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

      @@LlamAcademy oh that's nice. I didn't check the whole series as I just wanted to check the design pattern (even tho I have watched this video several times, i keep coming back. lol). Seems like I should put in proper time to watch the whole series.

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

    I did the same thing you did in the video, but it didn't work, only the gun was on the player's body. I deleted them with impcat type , player ik or something . Can you post the player ik script file? and can you solve this problem of mine please because we will enter the game contest

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

      The full project is on GitHub. You can check out the whole thing working together. Link’s. In the description

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

    is it possible to do trail without object pooling because i am in 2020 and i cannot access unity object pool

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

      I would really recommend to use some form of object pool for this. In my earlier videos when 2021 wasn't out I made a simple one you can use (video: th-cam.com/video/fsDE_mO4RZM/w-d-xo.html code: gist.github.com/llamacademy/e3ed9e647b2c703d698a809d00a112a8 )
      If you don't want to, you can use Instantiate/Destroy instead of getting objects from the pool and disabling them.

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

    i know this is a relatively old video but i wonder how can i change so instead of using the GunType enum to hold different guns, instead serve as a way to differentiate shooting modes, something like:
    enum GunType{
    SemiAutomatic,
    Automatic,
    Burst
    }
    I think i should have different Shoot functions and use a Switch to select the shooting mode depending on what GunType the Gun is assigned to, but i'm afraid that having 3 functions with almost identical code is a bad way to do this, so i don't know how to approach this

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

      In my game to differentiate between burst and automatic I applied a modifier to the gun to adjust the mode, "number of bullets per shot", and increased the delay between shots by 3x. In the "Shoot" function all I did was check if it was "burst" and started a coroutine to spawn 3 bullets over the course of several frames instead of 1 in a single frame. The outcome is minimal changes to "Shoot" and the rest of the gun system remained unchanged. Later on in this Gun Series I cover a modifier and attachment system that can help achieve this effect (around part 9 & 10).
      I didn't do Semi-Auto in my game, but I think that is possible to handle by just tracking if the player has at least 1 frame where they were not pressing "shoot" then proceed with the current code flow

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

    does someone know where can i get the IK and the doll that he is using in this video?

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

      Please see top of the description

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

      @@LlamAcademy i see it, thanks , btw im having a mistake with the prefabs, MuzzleFlash01 is missing, the model suposse to have it right? i download the github`s First version but is has the same problem

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

      I`v seen the read me doc and i could fix that problem, but still li light is pink, and i dont know where to get other particle to switch

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

    I am a new developer so please bare with me.
    If I used this approuch in a multiplayer game, wouldnt I run into trouble if two players used the same gun as they would share the clipsize?

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

      No, there would not be an issue there. Each player would have their own copy of the ScriptableObject that is being manipulated in that case!

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

    I keep getting error on the surface manager script

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

      Hi. The surface manager is not covered in this video and can be ignored, or you can watch the video about it to learn more:
      th-cam.com/video/kT2ZxjMuT_4/w-d-xo.html

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

    Hey one question which Third Person Controller Asset do u use ?

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

      I use the Unity Starter Assets Third Person Controller assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-urp-196526 It's free!

  • @0lt069
    @0lt069 15 วันที่ผ่านมา

    Hello! I have a little issue with trails, i tried to apply your system in my fps project, and it mostly works, but i can't see the bullet trails in game mode. Through editor i can see that they're actually going out of my gun(not the actual trails, but the objects, when i select them in editor) in right direction(i think it happens because i use 2 cameras, 1 of it actually renders weapon and all its children in overlay. But i have a problem with muzzleflash's child in weapon prefab, its not applying to layer for player weapon, that might be the issue, but i am still not sure).
    Sorry if my comment seems incorrect, English is not my native language.

    • @0lt069
      @0lt069 15 วันที่ผ่านมา

      I'm still looking for a solution, but as far as I can tell, the problem is not related to layers and cameras, because no matter what layer is selected, objects in it are always rendered except bullet trails

    • @LlamAcademy
      @LlamAcademy  6 วันที่ผ่านมา

      Sorry, hard to say without looking into your project. If you just run this in isolation it works so I think there's something going on within your project ☹

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

    Hey LlamAcademy, i love your video. however i have one small issue when adding public ImpactType ImpacType; i get the error CS0246: The type or namespace name 'ImpactType' could not be found (are you missing a using directive or an assembly reference?). is surface manger a addon i need to add to my unity project???

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

      Check out pinned comment & description!

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

    I keep getting errors saying "The name 'instance' does not exist in the current context" did I miss something?

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

      “Instance” should be capitalized. But for the surface manager, it’s not covered in this video. You can copy/paste the Surface Manager scripts from the repo: github.com/llamacademy/scriptable-object-based-guns/tree/main/Assets/Scripts/Surface%20Manager
      Or, to understand the implementation you can watch that video: th-cam.com/video/kT2ZxjMuT_4/w-d-xo.html

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

      @@LlamAcademy alright, thank you! I just kind of assumed such a generic word like Instance would already be used by unity!

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

      @@LlamAcademy alright one more question, got those errors fixed by going through the impact video, but now i get the error "UnassignedReferenceException: The variable ShootSystem of GunScriptableObject has not been assigned."

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

    Question: I love this implementation of yours because it's very flexible and can be built on top very easily, But I do have a problem. Most games have a gun-changing system or a gun equip system(the one where you can change the gun you are currently using at runtime). However your system doesn't support that, how could I modify it to let me do that? Sorry for the lack of proper punctuation and grammar, English isn't really my primary language.

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

      Swapping active guns may be a good topic to add to the series because it seems to be a highly requested topic. You can do a similar process to what is done in the PlayerGunSelector, or even reuse the logic from Awake when the player presses a button. If you have a game with a layout similar to Counter-Strike where you press 1,2,3,4 to swap weapons, you would just catch the key press, update the "Gun" to whatever is for that key, destroy the old gun, and re-run the Awake logic. Of course it would look better tying in animations, but that concept should get you started!

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

      @@LlamAcademy Thanks for the basic Idea, I'll try to implement it and if you don't mind, may I ask what is the next part after part 6 of the series going to cover?

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

    When i try to change active gun while game is running it says "The variable ShootSystem of GunScriptableObject doesn't exist anymore." what can i do to change my gun while game is running

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

      That's a more complex answer than I can probably reasonably do in a comment. I am planning on adding a video in the series about weapon swapping because that is a very commonly requested topic!

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

    Ive finished the code, im having trouble with line 42 of gunscriptableobject shoot() saying object refernce nnot set to an instance of an object. i need help :(

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

      Do you have a particle system as a child of the gun?

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

      I have the same issue ;-;

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

    I decided to cut out InverseKinematics since i'm using Unity Personal, so i really can't do it.
    If there is a workaround, please tell thee.

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

      There's no limits to functionality within Unity. You can be on Personal and still use this fully.

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

    Yo I added the trail but sometimes the trail for a bullet will just shoot off to the side and stretch out, is there any way to fix this?

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

      Hmm.... usually the only way I can get that to happen is if I don't wait a frame before reactivating the TrailRenderer. Can you compare what you have to what is on Github: github.com/llamacademy/scriptable-object-based-guns/tree/part-1 ? And if you get the same behavior with that, show me a short video of what is happening and what configuration you are using?

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

      @@LlamAcademy I'm having this same issue, the trail shoots to the last shot position and the new shoot position at the same time resulting in 2 rays. Sometimes there is a ray that shoots at totally random direction. I have no idea how to fix that.

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

      instance.transform.position = StartPoint; I was missing this line

  • @oakleysands-my1kt
    @oakleysands-my1kt 11 หลายเดือนก่อน +1

    why wont my private ObjectPool TrailPool; work
    this is the error Assets\Scriptys\GunScriptableObject.cs(21,13): error CS0246: The type or namespace name 'ObjectPool' could not be found (are you missing a using directive or an assembly reference?)

    • @oakleysands-my1kt
      @oakleysands-my1kt 11 หลายเดือนก่อน +1

      pls help🤔

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

      Which version of Unity are you on? The object pooling API was introduce in the 2021 LTS.

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

    Hey, thank you for the tutorial, I am new to unity and have tried to follow this for a couple of hours but have hit an issue, I'm not sure if it's due to me not using your SurfaceManager and Impact Manger, I have followed along and typed the code out exactly although I'm receiving this error while attempting to fire;
    NullReferenceException: Object reference not set to an instance of an object
    GunScriptableObject.Shoot () (at Assets/Scripts/Weapons/GunScriptableObject.cs:39)
    PlayerAction.Update () (at Assets/Scripts/Weapons/PlayerAction.cs:12)
    I've since tried copying your code from github and replacing the 6 files creating in this tutorial but I had the exact same error so I think I have missed something in the setup in Unity but I'm at a loss as to what if you have any advice I'd appreciate it.
    I've also tried importing Unitys particle system as recommended to another commenter but it didn't change anything.

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

      Can you give me the code at line #39 of GunScriptableObject.cs? From the repository on part 1 that is not a line that can give any error.
      If it is:
      Vector3 shootDirection = ShootSystem.transform.forward + ....
      It is important that your Gun model has a Particle System as a child of it and is positioned at the tip of the barrel. This is where all bullets will spawn. If you do not do this, ShootSystem will be NULL and give you that error. We assign ShootSystem on Setup() by doing: ShootSystem = Model.GetComponentInChildren();
      which requires that the Particle System is a child of the instantiated gun prefab model.

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

      Let me know if you run into any issues after doing that!

  • @Sergon-23
    @Sergon-23 ปีที่แล้ว

    Hello, does anyone know in what video does he implement the IKs for the gun holding animations? Thanks in advance!

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

      #12 Aiming with Inverse Kinematics (IK) and Animation Rigging | Gun Series 12 | Unity Tutorial
      th-cam.com/video/chgLRjSaoXc/w-d-xo.html

    • @Sergon-23
      @Sergon-23 ปีที่แล้ว

      @@LlamAcademy thank you, good sir! Have a nice day!!!

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

    I am getting errors saying
    Assets\GunScriptableObjects.cs(135,50): error CS1002: ; expected
    Assets\GunScriptableObjects.cs(119,15): error CS1513: } expected
    Assets\GunScriptableObjects.cs(119,15): error CS1002 ; expected
    Assets\GunScriptableObjects.cs(52,48): error CS1001: identifier expected
    Can you put the scripts in a GitHub, or type it in the Description because i have no idea what this means :/

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

      It is on GitHub and the link is in the description

  • @l.g5390
    @l.g5390 ปีที่แล้ว

    So if I not implement the part with the Surface Manager (the vid in the info) i have no visuals… so I have to watch the video and implement the surface manager etc right?

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

      You will not have impact effects, but you can also just pull the surface manager off GitHub. It’s included in this repository as well as the dedicated surface manager video repository.

    • @l.g5390
      @l.g5390 ปีที่แล้ว

      Thanks a lot

    • @l.g5390
      @l.g5390 ปีที่แล้ว

      ( this shouldn't be a link

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

    the Object pool keeps showing this error: "The type or namespace name 'ObjectPool' could not be found (are you missing a using directive or an assembly reference?)"

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

      We’re using the Unity 2021 object pooling system here. As long as you are on 2021 LTS or higher you should be able to add “using UnityEngine.Pool;” at the top of the script and it should work for you.

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

    awesome tutorial man! I've been looking for this exact kinda tutorial since like last week! 😅
    Got a noob question for you, Is there a way to apply damage to a gameobject based on where the bullet trail ends up actually hitting? Just trying to see if I can simulate projectile based weapons but with raycasts so players could effectively dodge bullets if they get out of the way of the bullet trail before it makes contact with them? 🤔

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

      You could do something like Physics.OverlapSphere or OverlapBox after the trail reached the target location to be sure the object is still within range of error to count as a hit. Assuming you have fast moving objects, by the time the trail got there the object could have moved too far away to count as hit and you could continue the trail as though it missed altogether

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

    How do games make gun skins? Sometimes, the skins make the gun very different than the original gun. Example: valorant. Skins make guns have different trails, recoil, textures, even different models of the same gun

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

      In the most recent videos in the series, we build out the systems to enable exactly what you're talking about. For a Skin, you can apply the same concept as any other modifier, where it can also apply a different shader or material to the gun.

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

      @@LlamAcademy hi, thanks for your reply. But what about guns that have completely different mesh for skins? Like in valorant, many guns have skin specific components

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

      Sounds likely they just have a different prefab with the same base model and each skin can have fancy other attachments or different materials

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

    Mr. Chris sorry to bother you but where on github can I download all the most recent scripts for this shooting project. I thought I downloaded all the scripts but the code has errors in surface manager and a few other places

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

      Hi! If you download the project from github.com/llamacademy/scriptable-object-based-guns and follow the setup instructions there (downloading Unity Particle Pack for example) it should work with no errors.
      Each video has a branch with exactly what you saw on that video. For this one, at the top left where you see a dropdown that says "main" you can change that to "part-1" and it will reflect exactly where this video ended.
      If you download the latest "main" and it has some errors, can you share those exact error messages along with your version of Unity so I can troubleshoot those? It should be very easy to get working.

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

      @@LlamAcademy Thank you for your help that worked.

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

    I have a two errors
    Assets\Scripts\Gun\PlayerGunSelector.cs(15,12): error CS0246: The type or namespace name 'PlayerIK' could not be found (are you missing a using directive or an assembly reference?)
    &
    Assets\Scripts\Gun\PlayerGunSelector.cs(15,12): error CS0246: The type or namespace name 'PlayerIK' could not be found (are you missing a using directive or an assembly reference?)
    can some help plz
    Other than that its a good tutorial

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

      Please see top of description

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

    Hi, I'm using your ScriptableObjectBased Gun System on FPS game.
    When I walk and shoot at the same time, the bullet trail came from behind the gun(kind of behind camera).
    I tried to fix it by changing the startPosition of Trail at the begginingof the BulletTrail Coroutine, but it was same result.
    And also, when walk left, walk right and shoot at the same time, bullet trail start from air too,
    Do you have any idea how to prevent from happening these.
    Thank you for your great tutorial.

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

      Hey! I think someone else asked about that in the comments of one of the videos, but I can't seem to find it now.
      In most games, this "problem" exists because the player and the gun are moving. Even though we spawn correctly from the barrel of the gun, that was at a snapshot in time.
      I looked into several other AAA games to see if this was something of an oversight that I had or what the deal was. It turns out even AAA games either: have this problem, or mitigate it by having extremely short bullet trails.
      The solutions I see are:
      1. Leave it alone and have this "problem" - it can be mitigated somewhat by having smoke or something that comes out of the barrel afterwards to mask the effect.
      2. Have very short lived bullet trails - player can't see the "problem"
      3. Bind the start position constantly to the barrel of the gun (this results in "bending" of the trail which may not be desirable).

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

    I don't know how to fix the problem. Please somebody help me
    Null reference not set to an instance of an object
    GunScriptableObject.Shoot().cs:246

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

      Hmm… from this video GunScriptableObject does not have 246 lines of code. Can you please review your implementation compared to the part-1 branch? github.com/llamacademy/scriptable-object-based-guns/blob/part-1/Assets/Scripts/Gun/GunScriptableObject.cs

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

    I'm getting this error:
    " NullReferenceException: Object reference not set to an instance of an object
    at UnityEngine.Rendering.Universal.UniversalRenderPipeline.SetupPerFrameShaderConstants () [0x00089] in :0
    at UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) [0x00065] in :0
    at UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) [0x0001c] in :0
    at UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, UnityEngine.Object renderRequest) [0x00046] in :0 "
    when i'm playing on build

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

      This seems like it an error related to URP 🤔 not sure

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

    can't find surfacemanager

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

      Check the pinned comment and description

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

      I'm sorry but I'm kind of confused I don't know what i'm looking for in the description@@LlamAcademy

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

      @mystocity In this video I DO NOT cover the Impact System: th-cam.com/video/kT2ZxjMuT_4/w-d-xo.html you can check out that video for the full explanation for how that works
      That’s for the SurfaceManager and ImpactType both. If you’re not interested in using that system for impacts, feel free to just remove that code! Everything will still work!
      PlayerIK is a very simple demo script implemented solely for the demo. As I mention in the video, this will be covered in the future, so you can skip that part for now, or check out the project on GitHub to see that naïve implementation.

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

      oh thanks for the help idk why I was so stupid@@LlamAcademy

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

    I don't know if you're still answering comments on this video, bit if you do, after the Player gun selector script it gives me an error, the type or namespace name "PlayerIK" could not be found". I've looked in the GitHub that you provided but even with your code it still happened. Help would be appreciated

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

      Seems like you are missing the PlayerIK Script: github.com/llamacademy/scriptable-object-based-guns/blob/main/Assets/Scripts/PlayerIK.cs
      Cloning the repository fresh I did not get the error. Can you try to make sure you don't have any other compiler errors that prevented it from picking up the script?
      This is not mandatory and I don't even really recommend to use it in your production game. You can skip all code related to PlayerIK and still have the shooting working. It will just not have the hands tied to the gun.

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

      @@LlamAcademy Thanks, I'll test it out

  • @10saltedalmonds17
    @10saltedalmonds17 2 ปีที่แล้ว

    Hello, I am having an error with this line of code
    remainingDistance -= TrailConfig.SimulationSpeed * Time.deltaTime;
    It says that TrailConfigurationScriptableObject does not contain a definition for SimulationSpeed. Is there any import or something that i missed? Any ideas of how to fix this?

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

      Seems like on the trail config you missed a step. Double check that section and what you have defined versus what is in the GitHub repository: github.com/llamacademy/scriptable-object-based-guns/tree/part-1

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

    Hi, i'm getting this error "MissingReferenceException: The variable shootSystem of SO_Gun doesn't exist anymore." after a few seconds on play mode, but i don't know how to fix it, somebody can healp me?

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

      Sounds like maybe your gun prefab doesn't have a Particle System as a child of it

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

      @@LlamAcademy thx for the fast answer, the problem was that i has the particle system, but my dumb-ass did not called it in the gun script…thx again