Search Unity

Feedback I'd like to know some best practices

Discussion in 'Scripting' started by fpmirabile, Feb 23, 2021.

  1. fpmirabile

    fpmirabile

    Joined:
    Jan 24, 2020
    Posts:
    12
    Hey guys, I hope you started well this 2021.

    I've been working on unity for a while now. I achieved a lot of things and I am pretty glad of it, but I reach a point where I have outstanding tasks, and idk how to answer them.

    I am working on a shooter right now. I implemented the Shooting System perfectly (Which is managed by a Weapon Controller, with gun holster, reloading, etc.) and also, I am using Scriptable Object for data of each weapon (type of shoot, automatic for example, bullets in magazine, fire rate, effective range, max range, etc).

    So that is the background you need to understand my questions... So here they go:

    1. Is that a good idea to use Scriptable Object for this ?
      So, we know each weapon has some constant data specifically for each (for example the fire rate), but each weapon has a magazine, but not all magazines has the same quantity of bullets left. Would you use SO for this?
      I feel like I can't screw up very easily if I go that way

    2. What is the best way to handle the weapon model? This question is more related to, how do you recommend to point the end of the gun, where the bullet flies from. Also, I couldn´t figure out a cool way to make the player hand grab the weapons (one handed and two handed)
      Keep in mind I'm trying to build a 3rd person shooter
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    ScriptableObjects are a great tool. Google up the Ryan Hipple video from Unite 2016.

    Hire a competent 3D artist to make it for you, or download some existing assets from somewhere. Make a prefab out of it and associate that prefab with what should be in the player's hand when that weapon is in effect.

    I usually put an extra transform in and call it "Muzzle"

    Again, that's just an animation, not coding. Get a good 3D artist or download some assets.
     
    fpmirabile likes this.