Unity Tutorial - Drag & Drop Tutorial #2 [RPGs, Card Games, uGUI] - finalbosscardgame.com

Unity Tutorial – Drag & Drop Tutorial #2 [RPGs, Card Games, uGUI]

quill18creates
Views: 159555
Like: 2651
Make sure to SUBSCRIBE so you don’t miss a video!
Download the complete project:
Also, please feel free to ask lots of questions in the comments.

This channel is mostly all about game programming tutorials, specifically with Unity 3d. You may also be interested in my primary channel, where I play and review games:

I can be reached at:
[email protected]



143 Comments

  1. Cool tutorial, but I want to ask about the OnDrop event. Is it possible to make sure that OnDrop events always happen before the OnEndDrag event? Or maybe sometimes make sure it's after?

  2. Copy pastes everything, has to delete false by pressing delete key, instead of just selecting the word and deleting it lol

  3. 4:13 In the latest version, the forced "width" and "height" is actually a distributed position within the panel, which is amazing.

  4. Is there a way to change the vertical position of some cards in the horizontal layout? I would like playable cards to be positioned slightly higher than the other cards.

  5. 2018 and your videos are still pretty awesome!! thanks dude!

  6. Hello. Thank you very much for your tutorial. It is very helpful. One question: If you use enum for extra slots and you want each extra slot to accept one card at maximum, how do you do that? I thank you in advance!!!

  7. You are a great teacher please keep making tutes!

  8. Hey Quill, I really liked how you added in the typeOfItem enum. Sticking with the card game idea I ended up utilizing this to make different drop zones for different types of cards (spell, monster etc. and deck as the default!). Awesome tutorial as always this really helped me not only implement an idea but really understand it. Thanks!

  9. In case anyone is watching this 3 years later.. I liked the idea of highlighting valid zones when a card is being dragged. I ended up going down a rabbit hole making a custom shader and conditionally applying that to a material on my zones, but I feel like this is overly complex. Is there an elegant solution you would recommend to make the zone glow programatically as Quill recommended?

  10. Black Lotus
    Converted Mana Cost: 0
    Artifact
    Tap, Sacrifice Black Lotus: Add three mana of any one color.

  11. Your tutorials are always so fucking freaking helpful. You have taught me so much sensei 😀

  12. What bugs me, as a guy who is used to programming that wont break if some name is changed etc is that in Unity you access components by their changeable names (not some ID like field that is always unique and can't be changed after an object is created). This way, if you forget something in the future or somebody else comes, everything could break just because one object (or a script) name has changed.

  13. I'm having some trouble implementing this in my own little test design. Basicly I have a dicepool wich holds 12 dice. I want to be able o drag them on different slots (a la diceydungeons). When I first got the dice to appear in the grid (when the game starts I add 4 to the dicepool) they appeared relly small in the game? So I just basicly adjusted the scale to enlarge them. Now when I drag them of the dicepool and adjust the parent back to the canvas they appaer super large again.. I'm missing the bigger picture here. Is it because you are working with UI elements on top of scene elements? I hope some of this makes sense to someone.. I was so exited to get this stuff to "work" (Generate random dice, place them in dicepool, drag them onto other slots to input a value..) but now..

  14. My first seen tutorial from quill18creates. Very lively and interesting, makes you think about the process and finding solution by yourself, gives detailed problem description. Really nice. Good job.

  15. Hey wounding how you make the full view card automatically minimize into a just the icon at a specific size and when hovering it shows the full card details and when you aren't hovering over it that full details card views goes away?

  16. Also, how would you make a vertical layout group only accept one item inside it?

  17. i cannot add these public class like IDropHanddler, it dosent seems to belong to anything about the engine code, any ideas?

  18. Hey I love your channel it really helps me learn unity. I love the way you show various things u can do 🙂 thanks a lot!

  19. Amazing tutorial. And the parts where you actually think about what you did wrong when the code does not work is really helpful. So next time we encountered those errors, we'll know what to do because you explained it so well. Keep it up! Thank you so much for this tutorial!

  20. is there any updates to this for 2019 or its all still good?

  21. At 22:30 I get Missing component error when trying to run:

    GetComponent<CanvasGroup>().blocksRaycasts = false;

  22. Did anyone have an issue where you can't change parent from OnBeginDrag, no matter what value you set it to, except for null?

  23. 3:01 – I didn't get this problem. I'm guessing it was changed for later versions?

  24. PUBLIC Transform PUBLIC Transform.
    Transform parentToReturnTo = null; Will Err out when d,parentToReturnTo = this.transform; Tries to call on it.
    It has to be public Transform parentToReturnto = null;

  25. I'm a bit late to comment on this,but would you be able to find the Horizontal Layout Group component,and OnDragEnd force it to update its children?

  26. At 24:50 I am getting the error AssetsDroppable.cs(18,15): error CS0122: 'Draggable.parentToReturnTo' is inaccessible due to its protection level. Any chance someone is still watching this and can help out? 😀

  27. Can somebady help ? When i try drop my card to drop zone then card go back to hand .

  28. me tomo unas horas pero lo entendi xd (estoy aprendiendo)

  29. I want my gameobject to be placed on 2D world space, from Canvas space. How would I achieve this?

  30. 28:30 Actually this COULD apply to our card game, depending on what kinda game you make. If you did a Yugioh Type game you could use this to distinguish Monster and Spell/Trap Cards, and specify monster and spell zones.

  31. This tutorial helped me out so much, so thank you for making it. I like the addition of the goof-ups in the video ! It's nice to see that even more professional game developers can mess up at times and not know what to do.

    I was wondering, if you were available, if you could help me out with an extra feature I wanted to add. With the tabletop panel, I wanted it to only be possible for one card to be inserted. I'm an amateur, so I wasn't sure how to go about it and was hoping someone could help me out a bit.

  32. one of the best tutorials I've ever seen. THANKS A LOT ; )

  33. Question. When I'm removing every card from a specified zone it's like it deletes the parent zone entirely. (While debugging I noticed the zones only extend insofar as the child objects locations. The pointer enter/exit debug messages only play when hovering over the child objects in the zones and not the preset locations of the parents zones, themselves, kind of like they are shrinking/expanding with the number of child objects. I'm currently attempting to figure out what's going wrong here, but having no luck so far.) Anyone have any ideas?

    EDIT: THANK YOU RANDOM GUY IN THE COMMENT SECTION. It simply wasn't picking up the zones but the cards in the zones with the raycast. You need to add an Image component to each zone (you can make it transparent after testing it out), but the Raycast from your mouse has to pick up the zone itself instead of the Canvas image for those who run into this issue.

  34. If you edited out problems i WOULD NOT have understand why things work or why they'd NOT work in my script.
    THANK YOU!!!

  35. idk why but when I made the Drop Zone exactly the same way you made it in the video, Unity is refusing to let me put it in the Tabletop or Hand. I can't put the Drop Zone script anywhere. I got a message when I clicked on the C# script saying "No MonoBehaviour scripts in the file, or their names do not match the file name."

    but the file names clearly match and there is MonoBehaviour scripts in the file. I did everything quill18creates did in the video for making the Drop Zone script. But it STILL won't let me put the Drop Zone anywhere because Unity thinks it does not exist. I saved this in the "Scenes" folder of my project. I can also see it in Unity.

  36. i know that this is late but i got problems with Draggable ParentToReturnTo because it's says that it can't get it because of protection level, i did everything the 2 tutorial covered(i think) but i got this problem

  37. Holy shit bro, really great explaining of the canvas group, you saved me 😀

  38. I had to go back to 2015 to get what I needed. 31:35 is a an alternative to having the onDroppedObject handle stuff and should be emphasized a little more.

  39. FindObjectsWithType should be avoid by the way. It's more easy to create a singleton GameMangager object in your scene and create in your GameManager a public list or array with all your DropZone objects.

  40. I'm not sure if you said this in the video, but if you did, I didn't catch it. And I'm also not sure if anyone else has commented on this. The drag functionality wasn't working for me. I had to add a 2D raycaster to my main camera to get this to work.

  41. Following everything I am unable to get the cards from the field to drop into the hand, not getting the console log either of card(1) dropping into hand, otherwise I'm handling well

  42. 7 years later I am in a different version of unity and this stuff still seems to work super hyped about that thanks

  43. I know the basics of C# and JS. But can you clear up why the 'this' keyword doesn't need to be used on the movement? I thought it was needed and you said "obviously" so I'm just confused lol

Leave a Reply

Your email address will not be published.