Це відео не доступне.
Перепрошуємо.
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
·······················································································
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
Thank you so much for this! Other tutorials made it so much more complicated. This helps me more than you know!
You're very welcome! :D
Thank you, you tutorial was extremely helpful! UnityEvents give so much opportunities!
Thanks for coming along to check this out, my friend! Best of luck with your new POWER!
Thanks a lot. Helped me out with my AR Foundation Projekt to spawn and despawn my placed objects. Thumb up!
That's no problem at all, I'm glad you found it helpful my friend! Good luck with your project.
Amazing video, saved my life, Thank you so much!
I really appreciate that, Juliano! Thanks for coming to watch! :D
Super useful tutorial!
I'm glad you think so! :D Thanks for watching!
Is there a way to pass through the parameters because thats what i really need it for
nice tutorial thx teacher very sample to know
Glad you liked it!
great tutorial :)
Thank you!
Thank you for this tuto :)=
You're very welcome! :D
Nice tutorial
Thank you! Cheers!
this was cool and interesting :D i need to play around with this hehe :D
Haha, let me know how it goes! :)
@@SpeedTutor Yes :D
Thanks
That's no problem at all! :) Thanks for checking this out.
1:40 closest you'll ever come to being Denzel. lol jokes aside thanks for the video.
Haha, you're very welcome - You can cast me in another movie, if you'd like? :)
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!
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! :)
@@SpeedTutor Sure it helps! Thanks so much for your reply, cheers!
No worries at all! :)
Just what ur name says, exact video what i wanted thanks:)
I'm glad I could be of service to you! :D
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.
I don't think so, no. As you're only invoking the event when you call it to do so. :)
nice
Thanks! :)
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? 😀
I'm not sure what you mean! Sorry :(
@@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
Yes, it could be totally possible! This is usually what you would use "OnClick" events on the actual buttons of UI's anyway! :)
that sounds great but i need more example please
Didn't expect that intro really
I like to surprise you! Haha.
How would you do this with GetKey Down/ Get key?
Just add an Update method and add those lines in! :)
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.
I basically want to trigger a particle system once the player has achieved a certain score.
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.
@@SpeedTutor Thank you! I'll try it out
@@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!
Good job! :)
how to inactive again after exiting from the player collision?
Use OnTriggerExit?
@@SpeedTutor worked..Thank you
How do you pass an argument from the event to the function with a unityevent?
That's a very good question. Did you search that into Google?
@@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 ^^.
@@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.
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...
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! :)
@@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
I feel so in woke
you sound like mr creepy mc pasta whatever his name is the guy that read s creepypastas
I'm not sure whether that's good or bad? :o
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.
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! :)
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.
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.