年前最后一贴,祝自己在明年能获得更多的Exp.
在为ui写shader时 一定要考虑到 ui mask 的问题, 加入对应的裁剪代码.
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
ZTest [unity_GUIZTestMode]
#include "UnityUI.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#ifdef UNITY_UI_CLIP_RECT
col.a *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip (col.a - 0.001);
#endif
来源:CSDN
作者:拔箭四顾心茫然
链接:https://blog.csdn.net/qq_26365139/article/details/104039154