WENZHAO LI
  • Home
  • Modeling
  • TechArtBlog
  • About

TechART Blog

Delegates and Events in Unity

2/21/2018

0 评论

 
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 评论



写评论。

    Author

    Write something about yourself. No need to be fancy, just an overview.

    Archives

    November 2021
    September 2021
    August 2021
    July 2021
    June 2021
    April 2021
    January 2021
    November 2020
    October 2019
    September 2019
    February 2019
    November 2018
    July 2018
    February 2018

    Categories

    All

    RSS Feed

Powered by 通过可定制的模板创建自己独特的网站。
  • Home
  • Modeling
  • TechArtBlog
  • About