有关Unity的一些小事

计算同一帧内耗时

1
2
3
4
5
6
7
Stopwatch sw = new Stopwatch();
sw.Start();

TestMethod();

sw.Stop();
LogMgr.LogDebug(sw.ElapsedMilliseconds);

参考:https://blog.csdn.net/YE_wolf/article/details/77094994

AnimationCurve复制

前人之轮,值得一用~
https://github.com/akof1314/UnityAnimationCurvePopupMenu
主要是 AnimationCurveDrawer,AnimationCurveGUI,AnimationCurvePopupMenu这三个文件

效果
image

面板中有多属性的对象数组

1
2
3
4
5
6
7
8
9
10
[System.Serializable]
public class EffectControllerDestoryItem {
public GameObject go;
public float destroyTime = 0;
}

public class EffectController : MonoBehaviour {
public List<EffectControllerDestoryItem> delayItems = new List<EffectControllerDestoryItem>();
//...
}

image

参考:https://www.xuanyusong.com/archives/4371

shader 常用函数列表

https://blog.csdn.net/a6627651/article/details/50680360