http://www.unitygeek.com/delegates-events-unity/
https://unity3d.com/cn/learn/tutorials/topics/scripting/delegates https://unity3d.com/cn/learn/tutorials/topics/scripting/events Delegate A Delegate is a reference pointer to a method. It allows us to treat method as a variable and pass method as a variable for a callback. When it get called , it notifies all methods that reference the delegate. The basic idea behind them is exactly the same as a subscription magazine. Anyone can subscribe to the service and they will receive the update at the right time automatically. Events Adds a layer of abstraction and protection on delegate, this protection prevents client of the delegate from resetting the delegate and invocation list. Events only allow to add and remove method from invocation list.
0 评论
写评论。 |