DOTweenEditorPreview.PrepareTweenForPreview(tar.GetTween());
DOTweenEditorPreview.Start();
以Test脚本为例:
public class UTest : MonoBehaviour
{
public Tween GetTween()
{
var tw= transform.DOMove(Vector3.left, 2);
tw.onUpdate = () =>
{
Debug.Log("afdsaf");
};
return tw;
}
}
[CustomEditor(typeof(UTest))]
public class UTestEditor : Editor
{
UTest tar;
void OnEnable()
{
tar = target as UTest;
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (GUILayout.Button("NN"))
{
DOTweenEditorPreview.PrepareTweenForPreview(tar.GetTween(),false);
DOTweenEditorPreview.Start();
}
}
}
标签:GetTween,tar,UTest,Unity,DOTweenEditorPreview,DoTween,public,Editor
From: https://www.cnblogs.com/jephone/p/18183990