Ability Bar in Unity (Swap Weapons/Items)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ธ.ค. 2019
  • ✅ Get the Project files and Utilities at unitycodemonkey.com/video.php...
    Here's a great Hotkey Bar where you can Activate Abilities and Drag Drop them into a new position.
    How to Drag UI Windows and Send to Top in Unity
    • How to Drag UI Windows...
    Simple Drag Drop
    • How to Drag UI Windows...
    Simple Inventory System in Unity (Store, Use, Stack and Drop Items)
    • Simple Inventory Syste...
    If you have any questions post them in the comments and I'll do my best to answer them.
    🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
    See you next time!
    🤖 Join the Community Discord / discord
    📦 Grab the game bundle at unitycodemonkey.com/gameBundl...
    📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
    #unitytutorial #unity3d #unity2d
    --------------------------------------------------------------------
    Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
    I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
    You can see my games at www.endlessloopstudios.com
    --------------------------------------------------------------------
    - Website: unitycodemonkey.com/
    - Twitter: / unitycodemonkey
    - Facebook: / unitycodemonkey

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

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

    Drag and Drop any ability you want! Great for any game with multiple weapons/abilities or something like WoW or Terraria!
    🎮 Play 7 Awesome Games (Action, Strategy, Management) and Help Support the Channel!
    ✅ Get the Game Bundle 67% off unitycodemonkey.com/gameBundle.php

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

    Just started my game development journey. I appreciate you making these videos to help guide me along 👾

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

    Very nice, another top quality tutorial.

  • @brianwaltse281
    @brianwaltse281 3 ปีที่แล้ว

    Great work! Thanks for the info!

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

    awesome tutorial

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

    I love how it seems like all the recent videos are of stuff that I’m currently working on with my project xP
    But I enjoy seeing how you implement things vs how I would do it.
    Idk if you saw my reply from a few videos ago, but if your interested I have found out how to make a lit sprite shader that can selectively “self-emit” based on a mask that can be used to make parts of the sprite visible without needing a light source. Like glowing lava. I didnt want to bother you with a DM on discord, but if your interested let me know.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว

      I think I saw you lava gif somewhere, I've recently been researching more about Shader Graph and yup discovered the various uses for the Mask field. Thanks!

  • @457Deniz457
    @457Deniz457 4 ปีที่แล้ว +1

    AS ALWAYS !
    Thanks :)

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

    You are the best 😘 thank you

  • @sabrango
    @sabrango 4 ปีที่แล้ว

    THX!

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

    How would you apply this to dragging and dropping spell/abilities from a spell book to set the hotkey abilities? Lets say I had a spellbook the player could open with an interface and from there they could then drag and drop the icon which would then tell the hotkeybar what spell belongs in that hotkey slot?

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

    how different weapons are implementing in the script , please help . I really want to know about the weapons . Are the built into sprites or are they different objects ? or is it a modular system??? waiting for the reply. As always your scripting logics are awesome super clean and versatile I love to learn from you.

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

    Good

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

    I really hope that you will make *if You already not* an Udemy course,but course that contains all lessons that a begginer game developer needs to have.
    P.S You and Brackeys made me start game developing
    GL

    • @casualgermans
      @casualgermans 4 ปีที่แล้ว

      Actually, udemy is a ripping off content creators. You only get a good chunk of the money of they come through the link the creator provided, otherwise udemy takes like 50-75% of the revenue.

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

      Yeah at some point I want to make a really in-depth course going from complete beginner to intemediate.
      Glad to hear you started game dev, keep at it!

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

      @@casualgermans I said Udemy because I dont know any other website with content like that

  • @Bruno-mq5ss
    @Bruno-mq5ss 3 ปีที่แล้ว +1

    I'm very late but, how can I make that when I pick up the gun or object y goes to the slot and in the slot press the Alpha keys to have it?

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

      You need to combine the hotkey bar with some sort of inventory system
      th-cam.com/video/2WnAOV7nHW0/w-d-xo.html
      th-cam.com/video/isAmoM3RPEI/w-d-xo.html

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

    Hi Code Monkey, is there a way to disable a weapon thru code like an if weaponactive == true and than make the weapon appear in the ability bar and if there is a way how would i do it?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      Sure, you can enable or disable Game Objects with gameObject.SetActive();

  • @MarkJrLuat
    @MarkJrLuat 3 ปีที่แล้ว

    Hey, how do you setup multiple weapons, I alr got one gun (from ur tutorial), but how do you add another without making any errors?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  3 ปีที่แล้ว

      That depends heavily on how you set up your character/animations.
      With the system I used here it's very simple th-cam.com/video/fuGQFdhSPg4/w-d-xo.html
      Just swap out the game object for another one

    • @MarkJrLuat
      @MarkJrLuat 3 ปีที่แล้ว

      @@CodeMonkeyUnity you mean the "Aim" part? And do I need to make a new script or I can just make a new one (I just started last week xD)

  • @djiexn
    @djiexn 3 ปีที่แล้ว

    so lets start It should be "very simple" ;)

  • @achouriyassin
    @achouriyassin 3 ปีที่แล้ว

    how to change the place with joystick in playstation ???

  • @MultiPss
    @MultiPss 3 ปีที่แล้ว

    Followed until 13:33 but my UI seems to be not appearing both on the Scene and the Game. No errors. The UI is still instantiated as intended, it's just everything become invisible. I don't know if you are going to reply a 2 year old video. I hope anyone see this can help me. (using Unity 2020.3)
    Edit 1: I already check the Instantiated UI, everything should be Instantiated correctly, all the images and sprites is there on the inspector. but it is somehow invisible.
    Edit 2: The problem seems to be the UI is not Instantiated under Canvas
    Edit 3: Fixed the problem by add a tag to the canvas, and change the code to
    Transform abilitySlotTransform = Instantiate(abilitySlotTemplate.transform, GameObject.FindGameObjectWithTag("Canvas").transform);
    Hope this helps anyone!

  • @user-ig6tr2en3s
    @user-ig6tr2en3s 3 ปีที่แล้ว

    I am learning well.
    And where can I reference PlayerSwapWeapon.cs?
    and Where download name space Codemonky;

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

    Is probably stupid question here but is there a way for me to rename the Testing.cs class? I tried creating a new class and just pasted in the Testing.cs code but it's saying it can't add script to the gameobject (i also asked this yesterday on the wrong video lol - apologies!)

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

      Does the class extend MonoBehaviour?

  • @user-yg9rq6xn3o
    @user-yg9rq6xn3o 3 ปีที่แล้ว

    6:47 So you declared "instance" of AbilityType enum Then adds it to the List What reason is of it? If you are passing another "argument" of "WeaponType" enum You never used "abilityType" instance (link) You should pass "activateAbilityAction = ()=>player.setWeaponType(abilityType)" or you just could pass directly "player.setWeaponType(AbilityType.Pistol)" P.S I consider you just forget to change

  • @Ricq777
    @Ricq777 4 ปีที่แล้ว

    Can you make Card game

  • @Zereze
    @Zereze 4 ปีที่แล้ว

    1:59 what are the codes you didnt show us? because my code doesnt work without them

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

      The implementation of those functions is irrelevant to the Ability Bar.
      It depends heavily on how you set up the rest of your game like how your animation system works. Your Ability Bar shouldn't care about how its implemented.

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

      @@CodeMonkeyUnity ok thx

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

    Hey, How Would You Implement This With Your Inventory System You Made Previously?

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

      For the hotkeyability callback you would just hook that onto the item.Use(); function

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

      @@CodeMonkeyUnity thanks for the reply on a video from 2019 your the best

  • @user-yg9rq6xn3o
    @user-yg9rq6xn3o 3 ปีที่แล้ว

    what script editor do you use?

  • @LemuriaGames
    @LemuriaGames 3 ปีที่แล้ว

    Wouldn't it be better to define the entire ability as a scriptable object, including its icon and all, rather than having an enum?

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

      Yeah this video is pretty old and it's before I really started using Scriptable Objects.
      So if I made this video again nowadays I would probably use Scriptable Objects to hold all that data.

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

    I know it may be asking a LOT; but can you pick better names for your files. Unity DOES not like when you use the same file name. FOR instance, lets say you wanted to use an AWESOME Code Monkey package for Inventory, he sounds familiar, ANYWAYS lets say you implement this and import that package, it breaks the inventory... why?
    When you wrote the Inventory, or pretty much ALL Your packages, you use the same name Testing so when you import, it breaks the sprites from this tutorial and many other packages.
    AbilityBarTesting does not take THAT much more work, vs UIAbilityButtonHotbarActionSystem, OK not as bad, but was close to what you did in this video.
    Anyways, you seem to have a package with MOST of your projects, but seem to break them as you go, for some reason. You can't use past ones and future ones, as it breaks the code.
    ANOTHER idea is to put it under a namespace. BUT thats like WELL advanced.

    • @micaiahstevens8840
      @micaiahstevens8840 4 ปีที่แล้ว

      KEEP up the great work, you seem to be lasting and consistent, SURE you can't fix all your past mistakes, but we can make CodeMonkey the way to go. I am ALMOST going to build a game simple based on ALL the code monkey packages.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว

      I've thought about that but it would make the videos a tiny bit harder to follow instead of just using "Testing"
      I do come across all those issues every now and then when I update my base project and what I do is import the package into an empty project and rename the files there before copy pasting into my base project.
      One possible solution I have thought about is after the video is recorded rename Testing into Testing_AbilityBar

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

    3

    • @Zereze
      @Zereze 4 ปีที่แล้ว

      ?

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

    1