教程网址.https://www.fairygui.com/docs/unity/insert3d
这是原文:首先将列表转换为一个组件,在组件内拖入一个矩形图形覆盖列表的视口,然后将这个图形设置为组件的自定义遮罩。
这里分下步骤:
1.将列表转换为一个组件,
2.在组件内拖入一个矩形图形覆盖列表的视口
3.然后将这个图形设置为组件的自定义遮罩。
4.修改Shader文件
1.2.3的步骤
第4步,直接copy啦,有能力者自己再写的完美点
Shader "fgui_Particles/fgui_CutParticles" {
Properties {
_TintColor ("TintColor", Color) = (1,1,1,1)
_MainTex ("Particle Texture", 2D) = "white" {}
[HideInInspector]_AlphaTex ("Trans (A)", 2D) = "white" {}
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha One
Cull Off Lighting Off Fog { Mode Off }
ZWrite Off
ColorMask RGB
SubShader {
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_particles
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
sampler2D _MainTex;
//sampler2D _AlphaTex;
fixed4 _TintColor;
struct appdata_t {
half4 vertex : POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};
struct v2f {
half4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};
half4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.texcoord);
//col.a = tex2D(_AlphaTex, i.texcoord).r;
half4 result = 2.0f * i.color * _TintColor * col;
return result;
}
ENDCG
}
}
}
}
把自己的粒子特效prefab的shader都指定下…(都,都,都)指定
加载特效的代码在 fgui的例子13中
效果如图