Unity Coding Tips Part 1: Events and Delegates
1,116
Subscription preferences
Loading...
Loading...
Working...
24,491
139
0
Sign in to YouTube
Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to like prime31studios's video.
Sign in to YouTube
Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to dislike prime31studios's video.
Sign in to YouTube
Sign in with your Google Account (YouTube, Google+, Gmail, Orkut, Picasa, or Chrome) to add prime31studios's video to your playlist.
Uploaded on Feb 6, 2011
The first tutorial in a series aimed at showing some of the more esoteric features available to Unity developers. In this tutorial, we cover the basics of events and delegates. You will learn some simple techniques to make your code a lot more coherent and easier to manage.
This directly relates to our plugins (http://prime31.com/unity), many of which employ events for dispatching asynchronous operations.
-
Category
-
License
Standard YouTube License
Loading...
Loading...
Loading...
The interactive transcript could not be loaded.
Loading...
Loading...
Ratings have been disabled for this video.
Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Loading...
Advertisement
-
7:18
Unity Coding Tips Part 2: Extension Methodsby prime31studiosFeatured
6,146
-
19:03
C# programming(Delegates Real Time Implementation And CallBack Methods) Part - 33by Manzoor Ahmed
7,706 views
-
9:46
[Unity3D C# Tutorial] Prim's Maze (Part 1) Creating a Simple Gridby Austin Takechi
3,725 views
-
28:01
c# (Csharp) :- What is Lambda expressions , Action , Func and Predicate ?by questpond questpond
24,518 views
-
14:57
Events and delegates in C# Part 108by kudvenkat
4,475 views
-
8:13
C# Basic Observer Pattern Using Delegatesby Jamie King
1,169 views
-
19:26
Unity 3D C# Series 1 Tutorial 1: The Basicsby Zeeshan Abid
9,877 views
-
0:45
Augmented Reality with Unity3D and SSTT - 2009by Hartmut Seichter
26,137 views
-
1:01:03
Game programming tutorial for the Unity3D Game engine (Simon Says)by inEarthCEO
12,141 views
-
14:03
Unity Coding Tips Part 3: Actionsby prime31studios
5,591 views
-
10:05
Delegates Intro 3 of 4by PETERTEACH
17,245 views
-
13:14
Building A Game In Unity Part 1: The Main Menu Tutorial 2/2by purdyjo
18,129 views
-
8:26
Delegate and Eventsby ITfundavideos
4,751 views
-
8:33
Unity Tutorials: Basic Javascript To C#by MoyaGames
3,026 views
-
4:58
How Events work in C#by teenprogrammer
9,222 views
-
8:43
14-Year-Old Prodigy Programmer Dreams In Codeby THNKR
873,145 views
-
10:11
Unity 3d Tutorial - move around in C#by steamisM50
23,286 views
-
8:04
c sharp Eventsby learningdom
14,887 views
-
10:43
Advanced C#: Using the Observer Pattern (Part 1 of 3)by ptyork
7,822 views
-
7:08
Event Handlers (Advanced Netduino Tutorial)by netduino
30,416 views
- Loading more suggestions...
Uploader Comments (prime31studios)
St4rdog 1 year ago
This seems similar to "CSharpMessenger Extended" (google it). Other than performance is there any reason it's better? I notice for one thing you will get AutoComplete for the event name, instead of having to type a string.
Sign in to YouTube
Sign in to YouTube
prime31studios 1 year ago
its similar but the key difference is that native events are associated with an object whereas the Messenger Extended is a string based publisher/subscriber system. Events will be faster due to skipping the initial string match.
Sign in to YouTube
Sign in to YouTube
Tiziano Cirillo 1 year ago
Great tutorial, practical and to the point. Thanks!
I found some generic information about this topic online but your example did it for me, will be using events/delegates from today :) - please do more :) c#/Unity :)
QUESTION: In term of performance on iOS, are events/delegates (with maybe quite a few events and listeners in a scene...) good to use or is there some performance issue compared to use some other solution to do the same things?
Sign in to YouTube
Sign in to YouTube
prime31studios 1 year ago
performance will be excellent on mobile. Events are WAY faster than SendMessage and will beat out any alternatives (like subscriber/message solutions).
Sign in to YouTube
Sign in to YouTube
lucidskater 2 years ago
any tips for learning from scratch, i cant seem to find a good tutorial for someone who doesnt know how any of it works
Sign in to YouTube
Sign in to YouTube
prime31studios 2 years ago
a quick web search will get you literally thousands of C# tutorials for beginners. There are also tons of books as well.
Sign in to YouTube
Sign in to YouTube
Top Comments
prime31studios 1 year ago
Many thanks for including your opinion just as we did in the video. We are making tutorial videos and thus would like those watching to be using the best tool. The advantages of C# over JS are concrete and there are many of them but that is a discussion too large for here. Some advantages are:
- TONS of C# learning/documentation resources
- language features that are not available in JS
- no sneaky compiled code (look at compiled output of JS transform.position.x = 3 as an example)
Sign in to YouTube
Sign in to YouTube
Sinister Rainbow 2 months ago
This is by far the best tut i've seen on the topic i've seen in looking around for the last hour. For someone coming to Unity/C# from other game engines this satisfies..
Sign in to YouTube
Sign in to YouTube
All Comments (51)
dylophosaurus 10 hours ago
would you mine clarifying on "abstracting input" please? thanks :)
Sign in to YouTube
Sign in to YouTube
Jamie Lowes 3 months ago
Thanks for this! Totally didn't know about events until I saw them in the Prime31 GameCenter plugin for Unity this morning. Now it's all working. SuperInternetHighFiveâ„¢!! :D
Keep up the good work!! :D
Sign in to YouTube
Sign in to YouTube
Mike Desaro 3 months ago
It isn't too performance heavy but Input is already global so it doesn't make much sense. If you are abstracting input (which is required for mobile + desktop) then it makes more sense to use an event.
Sign in to YouTube
Sign in to YouTube
n3v4k 3 months ago
Would it be a good practice to notify other GameObjects about the value of (for example) Input.GetAxis() using an event inside the Update() funciton? or it is too performance heavy to fire events at every frame?
Sign in to YouTube
Sign in to YouTube
Mike Desaro 3 months ago
A static variable is absolutely not a replacement for an event.
Sign in to YouTube
Sign in to YouTube
deltamish 3 months ago
Nice tutorial.but you can achieve same effect by just declaring a static variable right or am i missing something here(Did i sound rude there if yes i ma really sorry)
Sign in to YouTube
Sign in to YouTube
oioichuck 4 months ago
Thanks for this tutorial. Extremely useful.
Sign in to YouTube
Sign in to YouTube
kang hoo 4 months ago
Thanks you very much.i hope it have more example ....
Sign in to YouTube
Sign in to YouTube
Patrick Davis 7 months ago
I just stumbled on this from the iTween website, and I wanted to thank you guys for putting this out here. Events are something I've struggled with in other languages and being new to C# having a clear discussion of what is a very elegant solution is great. Thank you!
Sign in to YouTube
Sign in to YouTube