Material doesn't have a texture property '_MainTex' (18028)

Hey,

I'm new to unity3d.

When I'm creating a terrain, I always get this error "Material doesn't have a texture property '_MainTex'"

How Can I fix this problem, I alread created a "Shader", but do I have to link the terrain to the shader or what???

Thanks

Edit: whithout the terrain I do not get any errors....

This tends to happen when code is copy pasted into the Unity shader file. It hates when you copy paste things. So just make sure you type everything yourself. It can be a bit of a pain when you're trying to follow a tutorial, but that's what happens. I imagine that some of you are having luck when you restart Unity because it may fix some line endings when it reimports assets. It may also be because you aren't defining your properties in the "Properties" section.

2 Answers

2

Search first for an existing question.

http://answers.unity3d.com/questions/45130/material-doesnt-have-a-texture-property-maintex

It seems your shader don't have a _MainTex property.

Btw. what kind of terrain do you use? The Unity-built-in terrain system needs some very special shaders.

From a chat in IRC, it seems to happen when you try to use Android or iOS as a build target.

Terrains aren't supported on either, so throws out the error.

I'm going to bug report that as a fairly unhelpful error though.