Forum begins after the advertisement:

Trying to add melee weapon

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #11844

    As the title says, I’m trying to add my own melee weapon to the game using the scriptable objects that the tutorial took you through. I’m having trouble and don’t know where to start. I have a animation for a flame sword swing, and I want to be able to play it with left click. I also want to try to make the prefab of the object show up next to the player. How could I go about doing this?

    Xavier Lee

    Hi yuun, here are some steps to guide you along the process of adding a new melee weapon to your game.

    1. First, you have to decide what your weapon’s type is. Since you have said that you want to add a melee weapon, you can skip this.
    2. Afterwards, you have to create your own scripts and derive them from the Weapon Base scripts we created in the Tutorial Series. Since you have stated that you have a Flame Sword animation, I presume you intend you create a Flame Sword weapon. In that case the two scripts would be FlameSwordController and FlameSwordBehaviour.
    3. These two scripts will handle all functionality for the Flame Sword. You can add in a reference to the animator here to animate the swinging.

    I’m not sure what you mean by making the prefab show up next to the player, so perhaps you can explain more about that.

    Hopefully this helps!

    Keep in mind that this is a very general layout of how to add a new melee weapon using the system we built in the Tutorial Series.


    When I said the flame sword next to the player, I meant that the sword would show up as if the player is holding, it, thus being next to player model. Also I did actually find out a way to do all of this through more research! Also, when the animation is playing, I have a box collider on the flame sword that will turn on at a certain point in the animation. It only sometimes works for some reason.


    Also another question, how would I rotate the flame sword with the player? I want to be able to attack from left and right.


    Hi yuun, if you want to make it attach to the player, that is a whole new layer of complexity to it. We’ll need to create a new equipment system to support this. It’s not a small task.

    I’m revamping the weapon system in this series to become more versatile, so you may want to keep your eyes peeled for that, though it should not arrive until next year.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Go to Login Page →

Advertisement below: