【Unity】技巧集合3

1. Node.js读取Excel文本相关

https://www.npmjs.com/package/read-excel-file

2. 血条位置更新:
相关参考:RectTransformUtility

// 更新血条位置
void LateUpdate() {
    var sPos = RectTransformUtility.WorldToScreenPoint(Camera.main, ch.transform.position);
    var pos = Vector2.zero;
    if (RectTransformUtility.ScreenPointToLocalPointInRectangle(pTrans, sPos, null, out pos)) {
        curTrans.anchoredPosition = pos;
    }
}

3. 代码中有个死循环,怎么调试

在C++调试模式下中断程序,并人为制造异常,然后Unity就会打印出堆栈,具体如下:

https://blogs.unity3d.com/2016/05/24/breakout-how-to-stop-an-infinite-loop-in-a-unity-c-script/

 

 

你可能感兴趣的:(Unity3D,游戏)