Joseph Mask
Joseph Mask
  • Видео 6
  • Просмотров 44 531
[Unity Coding Tutorial] An Intro To Event Systems - Creating Universal Object Interactions w/ Events
#coding #gamedev #indie #tutorial #unity #indiegame #learn
In this tutorial, we go through the process of creating Universal Object Interactions using C#'s Event Systems.
Scripts used in this Tutorial: github.com/JosephMask3D/Event-System-Tutorial-Scripts
-
"Sneaky Adventure" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
creativecommons.org/licenses/by/4.0/
"Brittle Rille" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
creativecommons.org/licenses/by/4.0/
Просмотров: 13 567

Видео

[Unity Coding Tutorial] Drag & Drop Inventories in Unity! #gamedev #tutorial #coding #unity #indie
Просмотров 14 тыс.Год назад
In this Tutorial we go over how to create a Drag & Drop style Inventory from scratch, with features of being able to pick up and drop floor items, and the ability to split and stack items. Rogue-Lite Items Tutorial - ruclips.net/video/iU6mKyQjOYI/видео.html UI Images Download - drive.google.com/drive/folders/16SXwRV52gU-CeTm6keOKqxieU-Q7oZ1O?usp=sharing Scripts - github.com/JosephMask3D/Drag-Dr...
[Unity Coding Tutorial] How to Create Rogue-Lite Style Items and Effects in Unity
Просмотров 14 тыс.2 года назад
In this Tutorial we go through how to set up the foundation for Rogue-Lite style Items and Effects in Unity
Unity Quick Tip Tutorial - How to set up Seamless Elevators & Moving Platforms in Unity
Просмотров 1,1 тыс.2 года назад
In this tutorial I show how to set up Seamless Elevators, Moving Platforms or any object that moves that you want your Player Character to ride on in Unity C#.
Recreating a Grace in Unity VFX [Tutorial]
Просмотров 1,2 тыс.2 года назад
In this tutorial, I go through from start to finish on how to recreate a Grace from the newly released Elden Ring in Unity's Visual Effect Graph and Shader Graph.
Adding Wear & Tear to Hard Surface Objects with the Multiresolution Modifier
Просмотров 4196 лет назад
In this video I show how to add wear & tear to hard surface objects with the multiresolution modifier.

Комментарии

  • @AntNeedsBoost
    @AntNeedsBoost 8 дней назад

    4:10 when i do this it doesn't increase the size of the white box and i can't seem to work out why or how to increase the size manually or anything, is there another workaround maybe?

  • @gdb5549
    @gdb5549 15 дней назад

    thanks for the help

  • @KhalilAKM
    @KhalilAKM Месяц назад

    I think this is so complicated, I'd rather use inheritance and a virtual function that could be overrode by every different type of interactable objects

  • @MrLingon
    @MrLingon Месяц назад

    OK one more comment - is there any reason to start the Interact class with creating the "interact" InteractEvent? It seems we only ever use the "GetInteractEvent" which in itself creates an "InteractEvent". What am I missing?

    • @JosephMask3D
      @JosephMask3D Месяц назад

      You should be able to leave the interact variable null if you wanted, it was set up like that to visualize that an interact script should automatically create its own instance of an InteractEvent on creation. the GetInteractEvent check/creation is just a failsafe to guarantee an interact script has an event when it needs to be used.

  • @Strongest845
    @Strongest845 Месяц назад

    good tutorial, that give me a good head start, but how do i edit data value in the class (damage, shot speed, delay shot...) without edit in script every time i want to change some data for balancing and debugging ?

  • @b0bcorp
    @b0bcorp Месяц назад

    Thanks for this! I've done about 20 of these inventories in the past and they always fall short. This one had just enough content to get me a working platform which I could expand to use scriptable objects instead of scripts for each item, and then added rightclick to use, cooldowns on similar items, and added all the other features I needed. Two days after completing this tutorial I'm now at the stage where I'm creating vendors and other niceties. Your core is easy to understand and easy to modify!

  • @MrLingon
    @MrLingon Месяц назад

    This video makes me think I'm out of my depth. Very interesting and I see the use for it, but damn if it isn't complicated

    • @artofadval
      @artofadval Месяц назад

      Not really. This guy just talks kind of fast and explains some things that aren't relevant to the subject (like layer masks)--there's no need to go into bitwise operations on a video about event delegates. He's good and obviously knows what he's talking about, but there are better tutorials out there and you shouldn't assume you're out of your depth because of the way someone teaches.

  • @madude007
    @madude007 2 месяца назад

    yo, this is really god, but is there any way to apply it to 2D? ive been trying so many things to get my player to register a object colider but it just doesnt work out, and with other methods i can open a interface but just once, when i want to be able to acces that interface multiple times, close it and re open as much as the player needs it, sort of a upgrading table in ultrakill, or the shadow mirror in hades

  • @muhammadawaiskhan4068
    @muhammadawaiskhan4068 4 месяца назад

    Hi great video, I had a question about the interact monobehaviour class. Could you elaborate on why we need the get functions of type InteractEvent like GetInteractEvent? Sorry if its a dumb question im new to this concept.

    • @JosephMask3D
      @JosephMask3D 4 месяца назад

      It just allows you to be able create > set > and get a reference to the interact event without making the interact event a public variable (which would display it in the inspector). It’s not strictly necessary its just for cleanliness - and also makes the interact event created inside the Interact mono behavior un-editable, since with the GetInteractEvent you can only *get* the interact event, you cannot *set* it from outside the script.

  • @kilkrook
    @kilkrook 4 месяца назад

    good ass tutorial, more people need to know about you

  • @MuchoBear
    @MuchoBear 4 месяца назад

    This is an amazing help, thank you!

  • @jaososchefget3632
    @jaososchefget3632 4 месяца назад

    This tutorial is absolutely legendary. I do wish that the screen with the code was a little bigger, I kept reclining back but my eyes weren't good enough to keep up with what was going on, but the content here so clearly explains stuff that's washed over me for the past 10 videos on these topics that I've watched, and gives me the resources to get started on this system in my own game.

  • @erfrid
    @erfrid 4 месяца назад

    Absolutely nice guide, thank you!

  • @roberteltze4850
    @roberteltze4850 5 месяцев назад

    First video that I've ever set to play at a slower speed.

  • @hldfgjsjbd
    @hldfgjsjbd 5 месяцев назад

    What you actually should use are events, ScriptableObjects and predicates. Maybe with creation of randomisation system

  • @idaevon6424
    @idaevon6424 5 месяцев назад

    Hello. Can't drop an item into the game world, returns to its slot

  • @Ryöken17
    @Ryöken17 5 месяцев назад

    Don't you have a function " OnDestroy()" ?

  • @Ryöken17
    @Ryöken17 5 месяцев назад

    i'm lost, i have a project to make multiples magic group, but i don't find anything to do it... i thought about Scriptable object, but some magic does dot and some can heal and some can change the move speed, how can i do it ? I think i can try same as items you did, but i still don't understand how to make different things... ( And to be more difficult, i have 3 characters, not one, so i need something to modify only one player and modify others different way based on the magic skill they have...

  • @TheKr0ckeR
    @TheKr0ckeR 5 месяцев назад

    Thanks for your effort on this. One thing I generally have dependency problems is, Once your interaction also affects your player, too. You need to call player.SetAnimation(chestAnim); for example when we want to do to player when chest is interacted. That is feel like holding your right ear with your left hand by putting your hand above your head. Its like; Player calls Interact method, Chest implements it, chest calls player's reaction to chest. How do you handle mutual interactions like that by both interactor and interacted object is affected?

    • @JosephMask3D
      @JosephMask3D 5 месяцев назад

      In your example I would rather have the player both call the interaction with the chest and also start its own animation, this also helps with timing if you need your player to scoot over to the chest before starting an animation you could handle that first, then activate the player opening animation along with calling interact at the same time.

  • @codehubhq
    @codehubhq 5 месяцев назад

    amazing video, however the background music, is annoying it sounds like the entry of the batman and joker scene. I keep waiting for it to end, but it never ends.

  • @Bimpyton
    @Bimpyton 6 месяцев назад

    What a damn good tutorial

  • @Ivan_Larsen
    @Ivan_Larsen 6 месяцев назад

    Joseph Mask, we have a problem. Does not draw the my cursor. But I fixed it like this: [field] Vector3 offset = new Vector3 (0f, 0f, 1f); Update() transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition) + offset; What my problem; I do all step by step; I work with ortographic Camera. But project was created how 3D Core, vesion 2021.3.36f1; Buy the way, nice gide. One of better in RUclips.

    • @JosephMask3D
      @JosephMask3D 6 месяцев назад

      Thanks for posting your fix. The Z value for UI positions is the depth away from the camera and negative values will put them ‘behind’ the camera (I guess a value of 0 will do this as well in orthographic, I didn’t know that). You can also use this to turn off elements you don’t want to see when there’s UI elements attached to 3D objects, I’ve used negative values for floating health bars on enemies that were behind the camera otherwise they will always draw even when the enemy isn’t on screen, for example.

    • @Ivan_Larsen
      @Ivan_Larsen 6 месяцев назад

      @@JosephMask3D Thanks for the advice. I take note. I understand correctly, what Input.mousePosition.z = 0f? I debug (mousePosition) and yes, mousePosition.z = 0.00; This is rhetorical question =)

    • @Ivan_Larsen
      @Ivan_Larsen 6 месяцев назад

      Addition: I catch one more problem. Problem next: When we click "mouse1" for clear Mouse.itemSlot, above another ItemPanel, the ItemPanel attached to our cursor. I fix this problem in ItemPanel added check only on Mouse0 in method OnPointerDown. Its look like this: if (Input.GetKeyDown(KeyCode.Mouse0)) _click = true; Based on this, I have folling quession. How to make "correct" organize InputSystem (not class, its idia in Architecture Project), that to make work to easier in the future? I`m noob in GameDev and I don`t know anything about creating the "correct" Architecture Project.

    • @JosephMask3D
      @JosephMask3D 6 месяцев назад

      @@Ivan_Larsen Just for clarification, you are asking how to go about creating a Sort function for the inventory?

    • @Ivan_Larsen
      @Ivan_Larsen 6 месяцев назад

      @@JosephMask3D Sorry for my english. I`m about something like this: Game Programming Patterns. To what extent I made the right decision to solve the problem and how convenient it will be to work with such code in the future. So that I don’t have to rewrite many lines of code in each script to implement control settings (hotkeys). If you don`t uderstand me, it`s not your problem, its my english) Sorry for waste your time.

  • @Turdstrider
    @Turdstrider 7 месяцев назад

    How do you get a item to do its effect once, unlike doing it per tick as you did in the first example with the healing? Or should I just do it as OnShoot and apply the buff in that circumstance. otherwise really good video!

    • @JosephMask3D
      @JosephMask3D 7 месяцев назад

      You could create an OnPickup method that you call only on the item you are adding to your item list as you add it to the list, or could add a bool variable to the item (in the same way you would add a variable to any other class near the top under the class name) to check if its been activated already if you are trying to do something more complex

    • @Turdstrider
      @Turdstrider 7 месяцев назад

      @@JosephMask3D thanks for the solutions! But how would I 'delete' an item? Like deactivate it when it is removed from the list.

    • @JosephMask3D
      @JosephMask3D 7 месяцев назад

      @@Turdstrider Same idea, create an OnDrop method that’s called in the same code that deletes the item. If you are trying to remove a buff that was applied then loop through the players buffs and deactivate it. If the item spawned an object you will need to maintain a reference to that object (like adding a reference variable to the item that you set when you create the object) and delete it when the item is removed.

    • @Turdstrider
      @Turdstrider 7 месяцев назад

      @@JosephMask3D Thanks for the quick and very insightful responses! I've actually just made an item that has a chance on shooting to fire a triple shot!

  • @perkthings
    @perkthings 7 месяцев назад

    honestly the best tutorial about abstract classes i’ve ever seen

  • @farisazhari3583
    @farisazhari3583 7 месяцев назад

    Thanks A LOT sir

  • @fv4202x
    @fv4202x 8 месяцев назад

    I always wondered how complex code Risk of Rain 2 has. Glad I found this video, you deserve more views. But please zoom in, in code editors

  • @oliver4080
    @oliver4080 8 месяцев назад

    Absolutely amazing video. I literally never leave comments ever but i really just had to say that this channel is gonna be huge one day

  • @blindsidedgames
    @blindsidedgames 9 месяцев назад

    What an excellent example. Thank you.

  • @imbcoffee
    @imbcoffee 9 месяцев назад

    Great content and very useful, thanks!

  • @CarmenXero
    @CarmenXero 10 месяцев назад

    This is one of the best game dev channels I've found. Super concise, great visuals, amazing explanations.

  • @DevChancey
    @DevChancey 11 месяцев назад

    Amazing! This kind of information is hard to find, glad I came across your channel. You make good design paradigms accessible.

  • @MrTekui
    @MrTekui 11 месяцев назад

    This is very impressive! Could this be expandable into more inventories? for example a base storage or a chest? I can see in the code that it's coupled to inventory and I wonder how an expansion of the system would work. Thank you for a great tutorial!

    • @JosephMask3D
      @JosephMask3D 11 месяцев назад

      Yes it could I think. I would try making a chest UI that’s basically identical to the player inventory UI, just in a separate location on the screen, and store item lists in chest object scripts, when the player interacts with a chest the system grabs the list and uses that to populate the chest UI.

    • @MrTekui
      @MrTekui 11 месяцев назад

      That sounds like it could work, I will try that. Thank you for a very quick reply :) Do you have a donation site like ko-fi or something similar? I would like to support you in some way to make more great content like this.@@JosephMask3D

    • @MrTekui
      @MrTekui 11 месяцев назад

      ⁠​⁠@@JosephMask3DThat sounds like it could work, I will try that. Thank you for a very quick reply!

    • @MrTekui
      @MrTekui 11 месяцев назад

      @@JosephMask3D Just coming back to this and say that it worked great to make a secondary inventory system for a chest. Although it's a bit coupled and a bit tedious to make more than one, it worked great for just having one more. Thank you again. Is it possible to make a donation to support this and future videos?

    • @JosephMask3D
      @JosephMask3D 11 месяцев назад

      @@MrTekui Glad to hear it worked! You might be able to use the Inventory script as double duty for both the Inventory and chest management since they will be so similar, and because you would usually want your inventory open as you use a chest, would just need to add a chest item list variable and update it with the currently selected chest, etc. I don't have any donations set up at the moment, but I really appreciate the thought.

  • @OrangeJuiceDroid
    @OrangeJuiceDroid 11 месяцев назад

    Simple amazing, there is no tim wasted in this tutorial. I implemented it with some troubles but only due to my own inexperience😃. It was exatcly what I was looking for.

  • @r1s1112
    @r1s1112 11 месяцев назад

    Hey, great tutorial. One question tho, why did u delete the license on github? Is this still usable under the old license, or what is the new one?

    • @JosephMask3D
      @JosephMask3D 11 месяцев назад

      That was a mistake, apologies. I updated it with an MIT license.

    • @r1s1112
      @r1s1112 11 месяцев назад

      Thanks! @@JosephMask3D

  • @kadiryumlu
    @kadiryumlu Год назад

    Please zoom in to code! It is hard to read.

  • @drewboardman9109
    @drewboardman9109 Год назад

    Can’t you use an interface to achieve the Interactable behavior?

  • @DennG
    @DennG Год назад

    Awesome in-depth tutorial. Keep up the good work! Thanks!

  • @STARmod
    @STARmod Год назад

    Bro keep up the good work, such high quality channel show be known, loving your videos!

  • @Proxy720
    @Proxy720 Год назад

    UNDERRATED!! i hope you upload more in the future

  • @NightHawx231
    @NightHawx231 Год назад

    Quick question, if i was then wanting to add a visual element to the UI, as in just like in Risk of Rain 2 for each item, how would i attach a sprite to each item? I have currently added a new Public Sprite in the image list script and then made a new function called GiveSprite() in the item Script. Then using a Resources.Load to find the image path in the GiveSprite() function so that it can load in to the game, but i feel like that is not a very good way to implement what im doing. Any tips? Edit: Well i just checked your other video on inventories hoping i would get a solution, seems like you do the same so I guess i'll move forward with that idea. Thanks!

    • @JosephMask3D
      @JosephMask3D Год назад

      Yes, I use the same idea for UI. Abstract classes cant appear in the inspector in Unity (without some heavy workarounds) because they aren't serialized, so you cant really drop a sprite into each individual item script like you can with a monobehaviour script, so grabbing a sprite from a Resources.Load directory is the easiest solution to tie a specific sprite to an item.

    • @NightHawx231
      @NightHawx231 Год назад

      @@JosephMask3D Thanks for the the quick reply, I literally just got it done working. I have one more question though, with the type of items i'd like to introdcute it would really be handy if for each time i had a GetStacks() function just to know how many stacks i have of one specific item. Whats a good way to implement this? A dictionary to keep track? private Dictionary<Item, int> stacksDictionary = new Dictionary<Item, int>();

    • @JosephMask3D
      @JosephMask3D Год назад

      @@NightHawx231 A dictionary would work perfectly well since that is one of its primary purposes, you could use the items name string as the key and whenever you add an item to the player you could also check the dictionary with TryGetValue or ContainsKey, and if it exists, up the value (or decrease if dropping an item), or add the item to the dictionary if it doesn't exist. You could also just do a loop of your itemlist, checking its name each loop, and once its found return the value.

  • @mikemu2074
    @mikemu2074 Год назад

    Really awesome video~! It saved me, as a beginner coder, I've been searched a video like this for days, yours got everything I need!

  • @anaanab
    @anaanab Год назад

    why dont u speak faster? i think ur not talking fast enough.

    • @Hattori_Fujiyama
      @Hattori_Fujiyama 11 месяцев назад

      too bad youtube doesn't have a feature built into the player the make the video play faster...

  • @darkxplayzz
    @darkxplayzz Год назад

    Hey! I dont know if you still respond to the comments, but I have a problem. When i drop my items they spawn very far from the player and keep going even futher in the y direction. I've done everything exactly like in the tutorial. Do you know the possible cause of this problem and a possible fix?

    • @JosephMask3D
      @JosephMask3D Год назад

      So for the spawn location, is your inventory script attached to your player GameObject, meaning the transform that is moving around the level with the player character? The DropItem method uses the transform of the gameobject that the Inventory script is placed on to determine the position to drop the item, the part in the Instantiate call that has *[this.transform.position + new Vector3(0, 1.8f, 0]*, if its attached to another object it will spawn on whatever object the Inventory script is attached to. As for the reason its moving forever in the Y direction; Other than giving the Rigidbody some velocity when we spawn our object, the rest of the behavior is handled by the Rigidbody settings in Unity. Maybe check the gravity settings in your Project phsyics settings (the same place that has the triangle of physics interactions, at the top, It should be -9.81)? Or if you mean it falls through the floor maybe check that your root item pickup object (the main parent object for the prefab) can collide with the floor.

    • @darkxplayzz
      @darkxplayzz Год назад

      @@JosephMask3D alright, i fixed it

    • @JosephMask3D
      @JosephMask3D Год назад

      @@darkxplayzz I was working on a reply as I got this 😅. What was the problem if you don't mind me asking?

  • @grandmax6223
    @grandmax6223 Год назад

    Are there optimized objects that can be pickup? if there are 2000 of them, there will be lags due to 2 Rigidbody and 2 colliders

    • @JosephMask3D
      @JosephMask3D Год назад

      In a situation like that you could put a trigger collider on the player with a simple script to check for hits and call the pickup, then you could simplify the items down to one object.

    • @grandmax6223
      @grandmax6223 Год назад

      @@JosephMask3D Is every new item a new script? And is it possible to somehow redo it for ScriptableObjects?

    • @JosephMask3D
      @JosephMask3D Год назад

      @@grandmax6223 It should be possible, the only info you need to get to the player is the name of the item and an amount. I don’t have much experience with ScriptableObjects though, so how to go about it using them I’m not sure.

    • @grandmax6223
      @grandmax6223 Год назад

      @@JosephMask3D thx bro

  • @CHASMLLC
    @CHASMLLC Год назад

    what would cause the image not to show up ,with no errors and the proper amount of 40 being displayed by 10 in 4 different boxes.. i basically only get the white image from the beginning but in the cavas elements it shows proper name and proper amount added to name.. only thing not working is the Item Icon image.. i get the white square

    • @JosephMask3D
      @JosephMask3D Год назад

      It might be the directory string in Resources.Load being slightly incorrect, so it finds nothing and sets the image to null, leaving a white square.

    • @CHASMLLC
      @CHASMLLC Год назад

      @@JosephMask3D thank you very much.. it was my spacing in that very area.. thank u

  • @fractal4633
    @fractal4633 Год назад

    Thank you for taking the time to make this!

  • @Aliberation
    @Aliberation Год назад

    Awesome content! Keep this up, please!

  • @ALKOOOL
    @ALKOOOL Год назад

    code smol i cant see

  • @322ss
    @322ss Год назад

    Thanks! BTW - if you created that bit mask / shifting example yourself, that must have taken forever to create, pretty nice! :)

  • @322ss
    @322ss Год назад

    Did I miss it, what do you use for your character? Character controller? IIRC physics objects (like RB, which I've usually used) don't notice parenting, or have things changed in last two years.

    • @JosephMask3D
      @JosephMask3D Год назад

      Using a character controller, apologies

    • @322ss
      @322ss Год назад

      @@JosephMask3D OK, that is what I guessed you would be using.

    • @322ss
      @322ss Год назад

      BTW - your inventory tutorial was really nice, I've done several inventories (which I don't like) so nice to see different ways to do inventories.

    • @JosephMask3D
      @JosephMask3D Год назад

      @@322ss Thanks sir, really happy that people are getting good use from that video