Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by vagabondking · Mar 08, 2011 at 07:03 PM · editorterrainmaterialsassetsmaintex

Material doesn't have a texture property '_MainTex'

I'm getting loads of error messages that say

Material doesn't have a texture property '_MainTex'
UnityEditor.DockArea:OnGUI()

I dug into the Editor logs and the precise message is

[/Applications/buildAgent/work/6bc5f79e0a4296d6/Runtime/Shaders/Material.cpp line 562] (Filename: /Applications/buildAgent/work/6bc5f79e0a4296d6/Runtime/Shaders/Material.cpp Line: 562)

Material doesn't have a texture property '_MainTex' UnityEngine.DetailRenderer:Render(Camera, Single, Int32, Single) UnityEngine.Terrain:CullAllTerrains(Int32) UnityEditor.Handles:Internal_DrawCameraWithGrid(Camera, Int32, DrawGridParameters&) UnityEditor.Handles:DrawCameraImpl(Rect, Camera, DrawCameraMode, Boolean, DrawGridParameters, Boolean) UnityEditor.Handles:DrawCameraStep1(Rect, Camera, DrawCameraMode, DrawGridParameters) UnityEditor.SceneView:OnGUI() System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) System.Reflection.MethodBase:Invoke(Object, Object[]) UnityEditor.HostView:Invoke(String, Object) UnityEditor.HostView:Invoke(String) UnityEditor.DockArea:OnGUI()

They stop if i delete the terrain, but persist even with a new terrain in a new scene. I'm sure I could work around this, but I'm curious now and want to track down why this is breaking. I have updated the project from pre-Unity3 to the current version, but wasn't getting this error before. Alternatively, does anyone have a way to hone in on materials/prefabs/assets that are causing problems within a project without moving or disrupting the whole project? Can you selectively disable them or something?

Thanks for your help

dylan

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image robert 4 · Mar 08, 2011 at 07:07 PM 0
Share

please add your sample script which case this error

avatar image ryanmillerca · Dec 16, 2012 at 10:08 PM 0
Share

are you building for Android or iOS?

9 Replies

· Add your reply
  • Sort: 
avatar image
11

Answer by JAAMY · Jun 12, 2019 at 12:12 PM

if you are using a SRP ( unity shader graph ) , open your graph in its graph window, then add a property with type of Texture2D then name it : "_MainTex" and also name it's reference to "_MainTex".

But Important : Remember to uncheck the button called "Exposed", save your asset and you should be fine. you don't need to use this new Property

alt text


annotation-2019-06-12-164049.png (68.3 kB)
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image yacth_Mon · Nov 26, 2019 at 07:35 AM 0
Share

It's worked for me. Thanks :D

avatar image Palineto · Aug 14, 2021 at 05:01 PM 1
Share

For me, the last part was the opposite. I had to check Exposed to get rid of the error, idk why. Just pointing this in case someone finds it helpful.

avatar image schlenger · Feb 09 at 08:44 AM 0
Share

Awesome - all necessary information in one answer! Thanks

avatar image
2

Answer by Andy Korth · Mar 22, 2011 at 09:40 PM

It's probably named something else in your shader.. or your shader doesn't have a _MainTex

Check your shader for a line like this:

Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
}

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jozxyqk · Oct 20, 2012 at 06:56 AM 0
Share

restarting unity worked for me.

http://answers.unity3d.com/questions/126458/material-doesnt-have-a-texture-property-.html

avatar image
2

Answer by DuckOfDoom · Jun 09, 2013 at 02:11 PM

I know this question is really old but I found a way to diagnose this error. You have to find your shader in project tab, select it and in inspector you will see an error. Then you can click "Open compiled shader" and it can give you clues about where the error is. I often mistype things and this helps me find errors.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image brigadir · Sep 29, 2013 at 05:08 PM 0
Share

DuckOfDoom, thanks (I can't upvote because of low rate)! Sometimes Unity Editor doesn't log error to console so we need to check shader tab.

avatar image
0

Answer by pepefirst · Jun 05, 2011 at 09:17 PM

After a crash in Unity I got exactly the same message. Anyone found a fix for this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by messyfresh · Jun 08, 2011 at 07:57 PM

Its all dependent on the shader you are using. I started with OpenGL ES1.1, then changed to OpenGL2.0. After i switched i noticed i was still getting the error. I had to change the graphics emulation properties under the edit menu to OpenGL ES2.0 and now the problem is gone. Im not sure if its a complete fix or not, but i dont get the error anymore. Hope this helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GetAssetPath returning incomplete path for default materials 1 Answer

Blending edges of textures in the Terrain Editor 0 Answers

Terrain texture editor panel is whited out 0 Answers

How do I know if trees in the asset store are paintable? 0 Answers

Exports Wrong terrain? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges