Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

Commit 36850ac

Browse files
committed
Replaced the unlit transparent shader
1 parent bbd76d0 commit 36850ac

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

Assets/UnitySlippyMap/Map/TileBehaviour.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public static TileBehaviour CreateTileTemplate (string tileName, AnchorPoint anc
272272
};
273273

274274
// add a material
275-
string shaderName = "Somian/Unlit/Transparent";
275+
string shaderName = "Larku/UnlitTransparent";
276276
Shader shader = Shader.Find (shaderName);
277277

278278
#if DEBUG_LOG
@@ -293,11 +293,11 @@ public static TileBehaviour CreateTileTemplate (string tileName, AnchorPoint anc
293293
/// <param name="texture">Texture.</param>
294294
public void SetTexture (Texture2D texture)
295295
{
296-
material = this.gameObject.renderer.material;
296+
material = this.gameObject.GetComponent<Renderer>().material;
297297
material.mainTexture = texture;
298298
material.mainTexture.wrapMode = TextureWrapMode.Clamp;
299299
material.mainTexture.filterMode = FilterMode.Trilinear;
300-
this.renderer.enabled = true;
300+
this.GetComponent<Renderer>().enabled = true;
301301
this.Show ();
302302
}
303303

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Shader "Larku/UnlitTransparent"
2+
{
3+
Properties
4+
{
5+
_Color ("Main Color", Color) = (1,1,1,1)
6+
_MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "white" { }
7+
}
8+
9+
10+
SubShader
11+
{
12+
Tags {"Queue"="Transparent" "RenderType"="Transparent" }
13+
Pass
14+
{
15+
ZWrite Off
16+
Blend SrcAlpha OneMinusSrcAlpha
17+
18+
CGPROGRAM
19+
#pragma vertex vert_img
20+
#pragma fragment frag
21+
#pragma fragmentoption ARB_precision_hint_fastest
22+
#include "UnityCG.cginc"
23+
24+
uniform sampler2D _MainTex;
25+
uniform fixed4 _Color;
26+
27+
fixed4 frag (v2f_img i) : SV_Target
28+
{
29+
return tex2D(_MainTex, i.uv) * _Color;
30+
}
31+
ENDCG
32+
}
33+
}
34+
}

UnitySlippyMap-csharp.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global
1717
GlobalSection(SolutionProperties) = preSolution
1818
HideSolutionNode = FALSE
1919
EndGlobalSection
20-
GlobalSection(MonoDevelopProperties) = preSolution
20+
GlobalSection(MonoDevelopProperties) = preSolution
2121
StartupItem = Assembly-CSharp.csproj
2222
Policies = $0
2323
$0.TextStylePolicy = $1

UnitySlippyMap.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global
1717
GlobalSection(SolutionProperties) = preSolution
1818
HideSolutionNode = FALSE
1919
EndGlobalSection
20-
GlobalSection(MonoDevelopProperties) = preSolution
20+
GlobalSection(MonoDevelopProperties) = preSolution
2121
StartupItem = Assembly-CSharp.csproj
2222
Policies = $0
2323
$0.TextStylePolicy = $1

0 commit comments

Comments
 (0)