DragAndDrop.StartDrag 开始拖放

static function StartDrag (title : string) : void

Description描述

Start a drag operation.

开始一个拖放操作。

Initiates a drag operation with the current drag object state. Use paths and/or objectReferences to setup drag state.

初始一个拖拽操作,带有当前拖拽物体的状态。使用paths和/或objectReferences设置拖拽状态。

参见: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:27

本脚本参考基于Unity 3.4.1f5

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