unity, EventType.MouseUp注意事项

 

如果鼠标移出了窗口范围,则即使鼠标抬起也不会收到EventType.MouseUp消息,所以只写

if(event==EventType.MouseUp){

  执行某操作

}

是错误的,会导致非常奇怪的bug,要写成:

if(event==EventType.MouseUp||鼠标移出窗口范围){

  执行某操作

}

 

原文地址:https://www.cnblogs.com/wantnon/p/5158677.html