1.在OnMouseDown()中使用了EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)如果無效,可以嘗試:
private bool IsPointerOverUIObject()
? ? {
? ? ? ? PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
? ? ? ? eventDataCurrentPosition.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
? ? ? ? List<RaycastResult> results = new List<RaycastResult>();
? ? ? ? EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
? ? ? ? return results.Count > 0;
? ? }
EventSystem.current.currentSelectedGameObject!=null 也能夠判斷是否點到了UI垒手,但是似乎也有使用條件篡九,還未深入了解库正,總之上面那串實測能用。
解決方案鏈接:https://answers.unity.com/questions/1115464/ispointerovergameobject-not-working-with-touch-inp.html
2.移動端安卓真機VS調試
解決方案鏈接:https://blog.csdn.net/ACwawayu/article/details/90242631
3.發(fā)現(xiàn)編輯器中Service標簽頁無法加載(無內容/黑屏)
來到service標簽頁---斷開網絡---然后刷新一下service標簽頁---這個時候會出現(xiàn)一些文字(項目名什么的,但是沒有unityads什么的按鈕)---接著打開網絡---刷新service標簽頁---完成。
我這里重新關閉了service標簽頁,又變黑了酬荞,重新重復上面的操作即可
4.使用blender導入unity后,發(fā)現(xiàn)模型在x軸上自動旋轉大約90°
方法1:導出fbx時點擊"!EXPERIMENTAL! Apply Transform"(中文:“瞧哟!實驗性混巧!應用變換”)。此方法不清楚有何風險
方法2:在blender中倒過來旋轉x軸90°勤揩,然后再應用變換咧党。
5.如何面吸附移動?
在unity中雄可,按住v(默認)是根據vertex頂點進行吸附凿傅。
那么在按住v選擇好頂點后,同時按住Shift+Ctrl数苫,這時候物體將根據選擇好的頂點在某個面吸附移動聪舒。
在不按住v的情況下,只按Shift+Ctrl虐急,是根據物體的中心/軸心(根據選擇)進行吸附移動箱残。
6.LoadSceneAsync如果無效可以嘗試放在Start()中而不是Awake()中
7.ScrollBar的步數(shù)應該是所需要的步數(shù)+1,比如你需要10步,那么就設置Number of steps為11
8.關于如何判斷場景scene是否存在被辑?
不能使用Scene.isvalid()來判斷燎悍,不管如何他都會拋出錯誤
可以使用SceneUtility.GetScenePathByBuildIndex/GetBuildIndexByScenePath來判斷,當場景為空時盼理,字符串對應方法會返回空字符串谈山,index會返回-1值