Це відео не доступне.
Перепрошуємо.

Unity Events Explained

Поділитися
Вставка
  • Опубліковано 29 лип 2020
  • In this tutorial we look at using UnityEvents which allow us the do multiple interactions on a single action, similar to how button on the UI have an "OnClick()" event. Unity Events have the power to make final interactions so much easier and re-usable!
    🎁 Get OVER 160+ Scripts, Projects and premium content on my PATREON HERE:
    ➡️bit.ly/SpeedTutorPatreon
    ·························································································
    🔥 INSANE UNITY SAVINGS: bit.ly/UnitySalesHub
    🕹️Synty Publisher Mega Sale: bit.ly/SyntyPublisherMegaSale
    🕹️SpeedTutor Unity Store: bit.ly/STUnityStorePuzzlePacks
    🕹️Unity New Release Discount Sale: prf.hn/l/BdvEmg3
    🕹️Unity WELCOME2022 Offer: bit.ly/UnityWelcome2022OFFER
    🔥 INSANE HUMBLE SAVINGS: bit.ly/HumbleBundleDeals
    🕹️Humble Tutorial Bundle: bit.ly/MammothUnityTutorialsB...
    🕹️Unity ART Bundle: bit.ly/UnityHumbleArtBundle
    🕹️Unity TOOLS Bundle: bit.ly/UnityInsaneToolsBundle
    🕹️SFX for Games Bundle: bit.ly/SFX-Music-For-Games
    🕹️Learn Programming Games Bundle: bit.ly/LearnProgrammingGames
    🔥Unity Materials / Files & More:
    🕹️CGAxis 400 PBR Material Bundle: bit.ly/CGAxisPBRDeals
    🕹️Synty Assets: bit.ly/SyntyLowPolyAssets
    🕹️Filebase Assets: filebase.gamedevhq.com/ (Code: SPEEDTUTOR2022 - Sign up for a FREE MONTH)
    🔥 UNITY SUBSCRIPTIONS:
    🕹️Unity Plus: bit.ly/UnityPlusDeals
    🕹️Unity Pro: bit.ly/UnityProDeals
    ·························································································
    💰BIG DISCOUNTS on my website, for my UNITY ASSETS:
    ➡️www.speed-tutor.com
    💬Join the Community Discord:
    ➡️ / discord
    💝 Make a donation to the channel:
    ➡️www.paypal.me/speedtutor
    ·························································································
    ⬇️ SpeedTutor Puzzle Assets:
    ➡️Unity Store: bit.ly/STUnityStorePuzzlePacks
    ➡️My Website Discounts: www.speed-tutor.com/
    ⬇️ SpeedTutor Best Selling Assets:
    🧩Adventure Puzzle Kit: bit.ly/STAdventurePuzzleKit
    🗒️ Note & Letter System: bit.ly/STNoteLetterSystem
    🔍Examine System: bit.ly/STExamineSystem
    🔢Keypad System: bit.ly/STKeypadSystem
    ⬇️SpeedTutor Model Packs:
    ➡️Unity Store: bit.ly/STUnityStoreModelPacks
    ➡️My Website Discounts: www.speed-tutor.com/
    My Assets include: Gas Mask, Flashlight, Generator, Themed Key , Padlock, Phone, Chess Puzzle, Lever, Valve Puzzle, Fuse Box & Safe Systems. Cardboard, Debris, Massive Models and more!
    ························································································
    ⭐ Connect with me:
    💬| Discord: / discord
    🐦| Twitter: / speedtutor
    📱 | Facebook: / speedtutoruk
    🖥 | Website: www.speed-tutor.com
    ·······················································································

КОМЕНТАРІ • 69

  • @SpeedTutor
    @SpeedTutor  2 роки тому +1

    The biggest EVENT in Unity history is right in this tutorial! :D
    🔥UNITY SAVINGS: bit.ly/UnitySalesHub
    🔥SpeedTutor Unity Store: bit.ly/STUnityStorePuzzlePacks
    🔥HUMBLE SAVINGS: bit.ly/HumbleBundleDeals

  • @flip2shoot567
    @flip2shoot567 3 роки тому +24

    Thank you so much for this! Other tutorials made it so much more complicated. This helps me more than you know!

  • @jopaslona1
    @jopaslona1 2 роки тому +4

    Thank you, you tutorial was extremely helpful! UnityEvents give so much opportunities!

    • @SpeedTutor
      @SpeedTutor  2 роки тому

      Thanks for coming along to check this out, my friend! Best of luck with your new POWER!

  • @kophotograph1803
    @kophotograph1803 2 роки тому +1

    Thanks a lot. Helped me out with my AR Foundation Projekt to spawn and despawn my placed objects. Thumb up!

    • @SpeedTutor
      @SpeedTutor  2 роки тому

      That's no problem at all, I'm glad you found it helpful my friend! Good luck with your project.

  • @julianodbz
    @julianodbz 2 роки тому +2

    Amazing video, saved my life, Thank you so much!

    • @SpeedTutor
      @SpeedTutor  2 роки тому +1

      I really appreciate that, Juliano! Thanks for coming to watch! :D

  • @Foxtrop13
    @Foxtrop13 2 роки тому +1

    Super useful tutorial!

    • @SpeedTutor
      @SpeedTutor  2 роки тому

      I'm glad you think so! :D Thanks for watching!

  • @msmigs1173
    @msmigs1173 Рік тому +2

    Is there a way to pass through the parameters because thats what i really need it for

  • @VFORVICTORY1000
    @VFORVICTORY1000 4 роки тому +1

    nice tutorial thx teacher very sample to know

  • @simonjelinek6214
    @simonjelinek6214 3 роки тому +1

    great tutorial :)

  • @AEKGAMES1
    @AEKGAMES1 3 роки тому +1

    Thank you for this tuto :)=

  • @iwayannararyapramana8788
    @iwayannararyapramana8788 4 роки тому +1

    Nice tutorial

  • @StigDesign
    @StigDesign 4 роки тому +2

    this was cool and interesting :D i need to play around with this hehe :D

    • @SpeedTutor
      @SpeedTutor  4 роки тому +1

      Haha, let me know how it goes! :)

    • @StigDesign
      @StigDesign 4 роки тому +1

      @@SpeedTutor Yes :D

  • @qasimahamad5075
    @qasimahamad5075 2 роки тому +1

    Thanks

    • @SpeedTutor
      @SpeedTutor  2 роки тому

      That's no problem at all! :) Thanks for checking this out.

  • @aes0p895
    @aes0p895 10 місяців тому +1

    1:40 closest you'll ever come to being Denzel. lol jokes aside thanks for the video.

    • @SpeedTutor
      @SpeedTutor  10 місяців тому

      Haha, you're very welcome - You can cast me in another movie, if you'd like? :)

  • @victor1102
    @victor1102 3 роки тому

    Thank you so much for your video explanation! As a Unity newb may I know what is invoke and what purpose does it serve in this context? Many thanks!

    • @SpeedTutor
      @SpeedTutor  3 роки тому

      It just allows call the method to run the Unity event. Check out the Unity page here: docs.unity3d.com/ScriptReference/Events.UnityEvent.Invoke.html
      Then you can checkout something like this: answers.unity.com/questions/1573258/what-is-a-callback.html
      I hope it helps! :)

    • @victor1102
      @victor1102 3 роки тому +1

      @@SpeedTutor Sure it helps! Thanks so much for your reply, cheers!

    • @SpeedTutor
      @SpeedTutor  3 роки тому

      No worries at all! :)

  • @darkdoom907
    @darkdoom907 2 роки тому +1

    Just what ur name says, exact video what i wanted thanks:)

    • @SpeedTutor
      @SpeedTutor  2 роки тому +1

      I'm glad I could be of service to you! :D

  • @juanb6570
    @juanb6570 11 місяців тому +1

    just to be sure, isn't it necessary to add an if/question to make sure the event isn't null? i know this is done with regular events but i'm not sure if this is done here or if it is necessary at all.

    • @SpeedTutor
      @SpeedTutor  11 місяців тому +1

      I don't think so, no. As you're only invoking the event when you call it to do so. :)

  • @beto5720
    @beto5720 3 роки тому +1

    nice

  • @PerionTermia
    @PerionTermia 4 роки тому

    I'm thinking of some use cases for this.. maybe if you use an item, do the item behaviour? And just do that with the vent system. Does that make sense? 😀

    • @SpeedTutor
      @SpeedTutor  4 роки тому

      I'm not sure what you mean! Sorry :(

    • @PerionTermia
      @PerionTermia 4 роки тому

      @@SpeedTutor if you have an item in the inventory, let's say a health potion and you right click that Item in the inventory, I thought you could just use that Event system to call the "HealPlayer()" function for example. Or something like that. I'm sorry if I explained it bad :D

    • @SpeedTutor
      @SpeedTutor  4 роки тому +1

      Yes, it could be totally possible! This is usually what you would use "OnClick" events on the actual buttons of UI's anyway! :)

  • @watercat1248
    @watercat1248 3 роки тому

    that sounds great but i need more example please

  • @viktorvanchov3093
    @viktorvanchov3093 4 роки тому

    Didn't expect that intro really

    • @SpeedTutor
      @SpeedTutor  4 роки тому

      I like to surprise you! Haha.

  • @echo7project904
    @echo7project904 3 роки тому

    How would you do this with GetKey Down/ Get key?

    • @SpeedTutor
      @SpeedTutor  3 роки тому

      Just add an Update method and add those lines in! :)

  • @abhijitbhushan
    @abhijitbhushan 3 роки тому

    Hi, I have a question. How do I instantiate a particle system only once, when the player has achieved a certain score? I'm currently using an if statement but it instantiates the particles every frame for the if condition being true.

    • @abhijitbhushan
      @abhijitbhushan 3 роки тому

      I basically want to trigger a particle system once the player has achieved a certain score.

    • @SpeedTutor
      @SpeedTutor  3 роки тому +3

      As you say, just have your bool to be true when you hit the score, have another statement which checks to see if that statement is true. If true, then instantiate, then set the bool to false and do something like reset the score.

    • @abhijitbhushan
      @abhijitbhushan 3 роки тому +1

      @@SpeedTutor Thank you! I'll try it out

    • @abhijitbhushan
      @abhijitbhushan 3 роки тому +1

      @@SpeedTutor It works! I knew I had to use a bool but it was in the wrong place. Fixed it now, thank you for your help!

    • @SpeedTutor
      @SpeedTutor  3 роки тому +1

      Good job! :)

  • @MedMotionEarth
    @MedMotionEarth 3 роки тому

    how to inactive again after exiting from the player collision?

  • @longuemire748
    @longuemire748 2 роки тому

    How do you pass an argument from the event to the function with a unityevent?

    • @SpeedTutor
      @SpeedTutor  2 роки тому

      That's a very good question. Did you search that into Google?

    • @longuemire748
      @longuemire748 2 роки тому

      @@SpeedTutor Thank you for the reponse.
      Yes I've tried to do some research on it, but I come up with the ScriptableObject Event. I don't know enough about it to understand it ^^.

    • @longuemire748
      @longuemire748 2 роки тому

      @@SpeedTutor I have the answer. It can indeed be done.
      When we choose the function to associate with the UnityEvent, we have two choices. We can take the function without it being linked to the UnityEvent or we can take this same function in "Dynamic".
      In my case it was a ProgressBar with a function waiting for an int. In the list of the Progressbar, I had the function in "Dynamic int" at the top of the list.
      I hope this is clear because my English is not very good.

  • @neverstepd7
    @neverstepd7 Рік тому +2

    Oh christ... That could had saved me a god awful lot of inheritances, I made a bunch of enemies that are turrets but fire different things like lasers and whatever, I could had used this to handle the shooting systems instead of copypasting symilar shooting methods, same thing for others that are essentially bees that have 2 different flying methods and a missile that is a copy paste of the bees...

    • @SpeedTutor
      @SpeedTutor  Рік тому +2

      I know how you feel, sometimes it's the more you know but think about the experience you've gained from working through the way you did and how you can optimise from now on! :)

    • @neverstepd7
      @neverstepd7 Рік тому +1

      @@SpeedTutor Yeah you are right, it is also good to have questions once in a while, today I was just doing a uml and the question just hit me, good video too btw thank you a lot

  • @zangarkhan
    @zangarkhan 4 роки тому +2

    I feel so in woke

  • @someobscuremusicchannel
    @someobscuremusicchannel 2 роки тому

    you sound like mr creepy mc pasta whatever his name is the guy that read s creepypastas

    • @SpeedTutor
      @SpeedTutor  2 роки тому

      I'm not sure whether that's good or bad? :o

  • @Thesupperals
    @Thesupperals 11 місяців тому +1

    You see, this is not exactly all that good of a tutorial because physics in Unity is already typed as Event based. I would humbly ask of you to introduce Unity Events in a much more complex manner where you are subscribing and unsubscribing to an Event made from scratch.

    • @SpeedTutor
      @SpeedTutor  11 місяців тому +1

      I completely understand what you mean, events and actions is a really powerful thing that you mentioned and I'll definitely have to cover that! :)

  • @cyberpunkspike
    @cyberpunkspike Місяць тому

    Watched it three times, still don't know when I should prefer an event over simply calling getcomponent in start() in one of the colliding objects. This video is terrible, and does not clarify many aspects of unity events.

    • @SpeedTutor
      @SpeedTutor  Місяць тому

      I would do it if I wanted many triggers that have a set of events but those events aren't always the same. Lets say, one opens a door by playing an animation, having a audio clip play and changing a script. Another might add something to an inventory. Events are often used on UI elements for easier interaction, because it doesn't need writing explicitly in code.