DragAndDrop.PrepareStartDrag 准备开始拖放

static function PrepareStartDrag () : void

Description描述

Clears drag & drop data.

清除拖放数据。

Clears everything stored in the drag & drop object and prepares it so you can write into it for initiating a drag operation.

清除所有储存在拖放物体的数据,并准备;所以你可以写入初始拖动操作。

参见:StartDrag, paths, objectReferences.

function OnGUI () {
	if (Event.current.type == EventType.MouseDrag) {
		// Clear out drag data
		//清除拖放数据
		DragAndDrop.PrepareStartDrag ();

		// Set up what we want to drag
		//设置拖放物体
		DragAndDrop.paths = [ "/Users/joe/myPath.txt" ];

		// Start the actual drag
		//开始实际拖放
		DragAndDrop.StartDrag ("Dragging title");

		// Make sure no one uses the event after us
		//确保之后没有东西使用这个事件
		Event.current.Use();
	}
}
最后修改:2011年5月27日 Friday 17:24

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。