c#扩展方法

dotween有一种写法


transform.DOMove


给Transform类扩展了方法


具体实现为

using System;
using UnityEngine;
public static Tweener DOMove (this Transform target, Vector3 endValue, float duration, bool snapping = false)
{
	return DOTween.To (() => target.get_position (), delegate (Vector3 x)
	{
		target.set_position (x);
	}, endValue, duration).SetOptions (snapping).SetTarget (target);
}


静态类,this关键字

原文地址:https://www.cnblogs.com/nafio/p/9137275.html