- Home /
Material doesn't have a texture property '_MainTex'
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.
Answer by Bunny83 · Apr 01, 2011 at 11:43 AM
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.
I'm using the "Unity-built-in terrain system" and I found this link before, $$anonymous$$y shader contains an "_$$anonymous$$ainTex".
Is there a tutorial for terrains???
Thanks
Answer by Mike 3 · Apr 01, 2011 at 07:09 PM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613120128im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
change terrain built in shaders 1 Answer
Can't use material with shaders which need tangent geometry on terrain. 1 Answer
Noob Question - Custom trees and aliasing 1 Answer
Improved Graphics for Terrain 1 Answer
Black Trees 2 Answers