Unity 2021.3.33f1
NGUI 2023.08.01
----
NGUI-UILabel의 Effect에서 Shadow와 Outline을 같이 적용하고 싶어서 찾아보고 올려둠.
UILabel에 세 곳에 소스 추가
public class UILabel : UIWidget
{
....
[DoNotObfuscateNGUI] public enum Effect
{
None,
Shadow,
Outline,
Outline8,
ShadowAndOutline, // Add
}
....
/// <summary>
/// How many quads there are per printed character.
/// </summary>
public int quadsPerCharacter
{
get
{
if (mEffectStyle == Effect.Shadow) return 2;
else if (mEffectStyle == Effect.Outline) return 5;
else if (mEffectStyle == Effect.Outline8) return 9;
else if (mEffectStyle == Effect.ShadowAndOutline) return 9; // Add
return 1;
}
}
....
public void Fill (List<Vector3> verts, List<Vector2> uvs, List<Color> cols, List<Vector3> symbolVerts, List<Vector2> symbolUVs, List<Color> symbolCols)
{
...
// Apply an effect if one was requested
if (effectStyle != Effect.None)
{
int end = verts.Count;
var symEnd = (symbolVerts != null) ? symbolVerts.Count : 0;
pos.x = mEffectDistance.x;
pos.y = mEffectDistance.y;
ApplyShadow(verts, uvs, cols, offset, end, pos.x, -pos.y);
if (symbolVerts != null) ApplyShadow(symbolVerts, symbolUVs, symbolCols, symOffset, symEnd, pos.x, -pos.y);
#region Add ShadowAndOutline
if (effectStyle == Effect.ShadowAndOutline)
{
pos.y /= 2;
pos.x = pos.y;
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, -pos.x, pos.y);
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, pos.x, pos.y);
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, -pos.x, -pos.y);
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, -pos.x, 0);
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, pos.x, 0);
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, 0, pos.y);
offset = end;
end = verts.Count;
ApplyShadow(verts, uvs, cols, offset, end, 0, -pos.y);
}
#endregion
if ((effectStyle == Effect.Outline) || (effectStyle == Effect.Outline8))
{
...
}
}
[출처] https://gamedev.stackexchange.com/questions/151329/all-sides-shadow-outline-in-unity-ngui
All sides shadow outline in Unity NGUI
How can I make such exactly the same shadow using NGUI?
gamedev.stackexchange.com