c# extension method

今天开始尝试使用 DoTween(开始还真是有点不习惯什么都先考虑是否用已有插件,而不是自己亲自写,一点点适应吧,当务之急还是实现需求,即使自己实现了,也就只是自己开心就好,软件就是这样,用的人越少,就越没有价值!)

发现一个神奇的地方:怎么gameObject,还有transform都多了几个方法,DoT怎么做到的!?

原来是这个鬼:c# extension method 类似oc的xxx(忘了。。)

贴一下Dot扩展代码:

namespace DG.Tweening
{
    public static class ShortcutExtensions
    {
        //
        // Static Methods
        //
        public static Tweener DOAspect (this Camera target, float endValue, float duration);

        public static Tweener DOBlendableColor (this Light target, Color endValue, float duration);

你可能感兴趣的:(游戏开发,unity,c#,编程语言)