how to fix all textures not marked as normal map

Hi all,

Well I appear to have upgraded a massive project from Unity 2 to 3 during the time that Unity wasn’t correctly marking textures as normal maps, and as a result have literally hundreds of textures with the “This texture is not marked as a normal map” warning and the “Fix Now” button. Is there a way to fix all these textures automatically without having to search through every object in every scene?

Thank in advance

I imagine an editor script could be written to do it. I’m kinda surprised one doesn’t exist actually, or maybe it does. Perhaps on the wiki, or in a forum thread? Seems there should be one somewhere.

I can’t find one and don’t have any experience coding Editor stuff. Any guru out there feel like a challenge? Anyone from Unity have any thoughts given that it was a Unity bug that caused this problem in the first place?

Thanks

I’d really like to know this myself as well.

There is this class here:

but it’s an editor class, which means you can’t put it’s scripts onto objects in the hiearchy and run them, so I don’t understand how you would get functions in that class to operate on things in the project pane

I could be wrong but I don’t think that is capable of fixing this issue. I’ve selected “Reimport All” from the assets menu so I’m hoping that will fix it - will find out when I get back to work tomorrow and will post the result on here.

cheers

I’m guessing http://unity3d.com/support/documentation/ScriptReference/TextureImporter-normalmap.html is what you want, from the list eem posted above. Followed by http://unity3d.com/support/documentation/ScriptReference/TextureImporterType.html and finally http://unity3d.com/support/documentation/ScriptReference/TextureImporterType.Bump.html

sorry but I don’t see how these can be used to fix the issue in my original post. Can you provide some more detail please?

Write something to go through various textures, perhaps all those in a specific directory or using a specific prefix or something

Create some kind of loop that checks each texture, the first link TextureImporter.normalmap, is it a normal map? true or false, if it is, move on to the next, if it isn’t, then run the third link, TextureImporterType.Bump (or TextureImporterType.Advanced) to convert said image into a normal map, then move onto the next.

I’m not writing it for you, because I’m not a coder, so I can’t. But that would be the general method you’d probably want to use to do it.

ok I’ll see how the reimport goes and if I don’t have any joy I’ll give that a shot.

Thanks for the help

FYI reimporting all the assets didn’t fix the problem.

After chatting to Unity support they said that reimporting the materials should popup a dialog box asking if I wanted to fix the incorrect normal maps. Didn’t work the first time but did the second.