Closed RobobertSmitty closed 6 years ago
It's possible that the Unity shaders have changed on us to the point that the Tiled2Unity shaders that depend on them are no longer supported. What version of Unity are you on? And can you send me one of the shader files that is failing to compile?
I'm on version 2017.3.0f. I can send one of the files later tonight or tomorrow from my desktop.
I just loaded a project in 2017.3 and the syntax for the shaders did change but that's something Unity should have taken care of for you automatically. There will be an // Upgade NOTE
message at the top of each shader file.
Shader "Tiled2Unity/Depth" { Properties { _MainTex("Tiled Texture", 2D) = "white" {} _Color("Tint", Color) = (1,1,1,1) _CutOff("Cut off", float) = 0.1 [MaterialToggle] PixelSnap("Pixel snap", Float) = 0 }
SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "TransparentCutout"
"PreviewType" = "Plane"
}
Cull Off
Lighting Off
ZWrite On
ZTest LEqual
Fog{ Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile DUMMY PIXELSNAP_ON
#include "UnityCG.cginc" //OVER HERE
#include "Tiled2Unity.cginc" //OVER HERE
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};
fixed4 _Color;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap(OUT.vertex);
#endif
return OUT;
}
sampler2D _MainTex;
float _CutOff;
fixed4 frag(v2f IN) : COLOR
{
half4 texcol = tex2D(_MainTex, IN.texcoord);
texcol = texcol * IN.color;
if (texcol.a < _CutOff)
discard;
return texcol;
}
ENDCG
}
}
Fallback "Sprites/Default"
}
Shader error in 'shaDepth': Can't find include file Tiled2Unity.cginc at line 35
The parts where I put //OVER HERE is where it is failing to compile
That shader looks okay and I've been able to run in both Unity 2017.3 and Unity 2018 beta. However, I wonder if Tiled2Unity.cginc is itself either missing (can you check? It should be in the same directory as those shaders) or itself not compiling correctly.
I've included that file just in case you don't have it. Note you'll need to remove the TXT extension, however. (Sorry, Github would not allow me to attach files with the GINC extension.) Tiled2Unity.cginc.txt
Tiled2Unity.cginc itself does not seem to be in the shader folder. I ran Tiled2Unity on my desktop at home and it seems to run no problem.
Prefabs on laptop are all purple/pink. I Added the file you gave me and it seems to have changed them back. Thanks for the help, you've been very responsive
Buuuut life of coding, one bug down another problem.
and after importing a map it seems more errors occurred, the maps seem to be bugging out in the unity scene
I'm trying to reimport those maps to see if that works
edit: Reimporting seems to have an effect, some maps have horizontal lines appear an move
Those lines are seams and they're easily the biggest headache on getting tile-based rendering working in Unity. Even the new built-in Tilemap stuff that comes new with Unity 2017.3 has that challenge.
I've written a bit about that here but keep in mind I'm working on a (totally new) version of Tiled2Unity that resolves these seams by automatically making texture atlases.
Then I guess I can close this then. Thanks for all the help, I'll be checking in on the new version of T2U
For what ever reason, I cannot use Tiled2Unity anymore. It changes all the previous imported prefabs into pink meshes. The errors all include a ".cginc" on lines 33/35. Reinstalling or downloading Tiled2Unity and Tiled does not seem work