Meshes without uv's warning

Since 2.6 came out I get zillions of warning about shaders wanting texture coordinates

A very large number of my models don’t have uv’s cos they don’t need them, the shaders are just plain colours. As far as I can see though you have to use at least one texture in your shader in order to use a combiner. This seems to work fine even without uv’s, i.e the final result looks correct. Is there a way to write a shader that combines various colours without using a texture?

In other words can you replace code like this

SetTexture [_MyTex] { 
			ConstantColor [_Tint]
			combine texture * constant }

with something that doesn’t need the _MyTex bit?

SetTexture [nothing] 
{ 
	ConstantColor [_Color]
	combine constant
}

Of course, that’s a flat color. No shape will be defined. If you need light, use the [_Color] variable, for whatever kind of light you need, in your material block.

Like this:

Shader "Lit Color" {
	
	
Properties
{
	_Color ("Color", Color) = (1,1,1)
}

SubShader
{
	Lighting On
	
	Material
	{
		Ambient [_Color]
		Diffuse [_Color]
	}
	
	Pass
	{
		SetTexture [nothing]
		{
			combine primary DOUBLE
		}
	}
}

}

Alternatively, if you find the way Unity handles Ambient light unintuitive, like I do, you can do this instead. You’ll probably want to use all of your own shaders then, though, and may run into some problems with more complex shaders that take lighting into account.

Shader "Lit Color DOUBLE" {
	
	
Properties
{
	_Color ("Color", Color) = (1,1,1)
}

SubShader
{
	Lighting On
	
	Material
	{
		Ambient (2,2,2)
		Diffuse (1,1,1)
	}
	
	Pass
	{
		SetTexture [nothing]
		{
			ConstantColor [_Color]
			combine primary * constant DOUBLE
		}
	}
}

}

cheers that looks like exactly what I need.

This is weird I’ve remade my shaders so they don’t need a texture map at all but they still throw the same warning about missing uv’s, any ideas?

Shader "VertexLit-Nodecal-Tint" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_Base ("Base Color", Color) = (1,1,1,1)
	_SpecColor ("Spec Color", Color) = (1,1,1,1)
	_Emission ("Emmisive Color", Color) = (0,0,0,0)
	_Shininess ("Shininess", Range (0.01, 1)) = 0.7
	_Tint ("Texture tint", Color) = (1,1,1,1)
}

SubShader {
	// Normal rendering pass
	Tags { "RenderType"="Opaque" }
	Pass {
		Name "BASE"
		Material {
			Diffuse [_Color]
			Ambient [_Color]
			Shininess [_Shininess]
			Specular [_SpecColor]
			Emission [_Emission]
		} 
		Lighting On
		SeparateSpecular On 
	    SetTexture [nothing] { 
			ConstantColor [_Tint]
			combine constant * primary DOUBLE }			
	}
}

}

I have seen some weirdness where that warning popped up, even if it made no difference in the scene. As in, it would say this for a UV’d mesh, and the mesh would still be textured appropriately.

However, I never spent any time trying to get a reproducible case. If you have that, please send a bug report.

Also, why are you using Color and Base Color? All that does is tint the light. If you’re tinting the object anyway, you don’t need to tint twice - just combine the tint into one color. You’re not even using _Base anywhere.

That’s just an oversight actually, I think at some point base colour was being used, I just forgot to take it out.

Its been a long time since this thread was posted, but are there any solutions to this problem?

I have a ton of meshes that do not need textures or UVs and I get spammed with constant warnings about missing UVs every second, which slows down the editor significantly. I tried using the solution posted in here but it did not help at all.

In the material box in the inspector there is no need for a texture, and yet the editor still freaks out about missing UVs and it is maddening.

This sounds like a bug, but I’m guessing nobody filed a bug report. I recommend doing so, and then at least someone at Unity will be able to take a look at the issue.

I reported this as a bug, but is there anything I can do to relieve this problem now? Can I tell the editor to filter those messages somehow? If I load up a scene Unity spits out the “shader wants texture coordinates” message at least 500 times immediately, which causes everything to grind to a halt before it finishes.

Sorry guys, no internet yesterday, so I couldn’t make sure I had reported this. (The heat apparently melted all the wires in the ground where I live. WTH?!) I reported this as bug 371222 on August 20, 2010. It is still listed as Open. My solution has been to make sure that the shaders do not utilize texture coordinates, and click on the model files in the Project window as little as possible - that tends to trigger the message, because the shader used for the preview wants uvs and normals.

Hi Jessy,

What is your method to make sure that shaders do not use texture coordinates now? I tried the solution you posted like two years ago by and it doesnt work. Even if I don’t touch the project window, the first time a model appears in the scene view it always displays that warning for every material no matter what I do.

I don’t know how to deal with that, unfortunately. I don’t feel that automatic material generation is useful, and turn it off in the PostProcessor.