<script> function myFunction() { var x1=event.clientX;//只需要将被调用的变量前的var删除即可在下个函数调用: document.getElementById("demo").innerHTML=x1; console.log(x1,'asdasdasd'); }; function hhh(){ var x1=window.x1; //这种调用方式无效 var x2=event.clientX; //判断鼠标按住/…
判断鼠标是否点击在UGUI上 #if UNITY_ANDROID && !UNITY_EDITOR #define ANDROID #endif #if UNITY_IPHONE && !UNITY_EDITOR #define IPHONE #endif using UnityEngine; using UnityEngine.UI; using System.Collections; using UnityEngine.EventSystems; public clas…