Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by dustxx · Feb 04, 2014 at 07:34 AM · texturematerialimport

Is it possible to automatically match materials to textures with the same name?

I think the title pretty much sums it up, but when importing a model I ripped from a gamecube game into blender then importing that into unity, I end up with a model without textures. Apparently this is a known problem with importing from blender. Fortunately, from the original rip I also have a folder with all of the textures and when I import the model unity automatically creates empty grey materials that are already matched with their game objects. Unfrotunately, these materials are blank. But they do have the same name as the texture files. I could go in and assign each material to the texture of the same name by hand, but that's a real pain with hundreds and hundreds of textures. Does anyone know of a good way to do this?

Comment
Add comment
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 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by gfoot · Feb 04, 2014 at 10:23 AM

Yes, it's pretty simple to do that. Editor scripts can find assets in the project directory and modify them. So you can use MenuItem to add a menu option to run your fix-up script, then in the method that is called, use the Selection class to get the selected asset(s), and for each one, check it's a model, and then loop over its materials running whatever algorithm you need to find the textures (e.g. using AssetDatabase) and assign them to the materials used by the model.

You can also hook the whole thing up to an asset post-processor, so that whenever a blender file is imported it automatically runs this step afterwards. You may also be able to use one of the more specialized AssetPostProcessor overloads to do this more cleanly, e.g. OnAssignMaterialModel, which is responsible for finding the right material in the Unity scene to use for each material referenced by the imported model.

Comment
Add comment · Show 2 · 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 kat0r · Feb 04, 2014 at 10:42 AM 1
Share

Asset post-processor doesn't require Pro.

avatar image gfoot · Feb 04, 2014 at 08:01 PM 0
Share

Thanks for the correction, I always thought it was Pro-only. I've removed the incorrect statement.

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

21 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Materials from cinema 4d to Unity 4 Answers

texture not applied, despite many attempts 2 Answers

How to Extract fbx file textures at run time or when file import 2 Answers

Blender 2.78 Unity 5.5 the correct way to retain material/textures on import? 7 Answers

Applying Tileable Texture to Imported Mesh 1 Answer


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