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 Creyke · Mar 23, 2011 at 11:13 PM · materialmaterialsfbxmaya

Set up Maya/FBX file so that it is automatically assigned an existing material on import?

Is there a way to set things up so that a newly imported FBX is automatically assigned an existing material? Based on the Unity docs it seems that this this should be possible but so far I am unsuccessful. From the docs...

"Materials are found based on the following rules:

Unity gets the name of the main diffuse material bound to the objects in the scene.

Unity looks for a material with this name in a Folder called Materials next to the scene.

Unity goes up the project folders, looking for the Material in each Materials folder along the way."

So basically what I tried is as follows:

1) Create a material in Unity called "MyMaterial"

2) In Maya create a mesh and assign it a material called "MyMaterial"

3) Export an fbx called "MyObject.fbx"

4) Launch Unity

At this point I would expect Unity would search the directory hierarchy upwards from "MyObject.fbx" and find "MyMaterial". However, it only seems to find the material if it is in a folder called Material which is sibling to the "MyObject.fbx". If that does not exist then it creates a new material called "MyMaterial" in a sibling folder.

Thanks!

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 Justin Warner · Mar 24, 2011 at 01:11 AM 0
Share

I remembered being mentioned, you shouldn't ever change something directly in the folder... Just change it manually, takes about an extra 5 seconds, and if you use UV maps, and get $$anonymous$$udbox or something of the like, you can do it all there and then import to Unity...

avatar image Creyke · Mar 24, 2011 at 02:04 AM 0
Share

Ultimately the problem I want to solve is one where I have a material shared by many objects. For example say I have a level with a bunch of buildings which share "BrickWall$$anonymous$$aterial". It would be nice within $$anonymous$$aya to assign a new building "BrickWall$$anonymous$$aterial", export to FBX and then have it automatically be assigned the correct material within Unity. Rather than have to manually hook it up and remove auto generated materials. Especially if this has to be done any time said building is adjusted and re-exported.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by loopyllama · Mar 24, 2011 at 04:43 AM

This doesn't solve the problem of "I want to assign an arbitrary material" but this does solve the "I have a material shared by many objects...auto assign that material on import".

I have found that it works when the material import setting is "per texture" and that I export the fbx to the same folder as the texture. For example a structure of /models/background/ where the material lives in /models/background/Materials...if you place the texture for that material in /models/background and you export your fbx files to the /models/background folder AND the source 3d file has a material that uses that texture AND the import setting is the default "per texture" under material generation, you will find it will finally be auto-assigned on import into unity. In this case I believe the name of the materials are unimportant.

I hope there is another better way but I know this way works and I am tired of fighting unity on it, so I just use the method described above.

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 Paulius-Liekis · May 09, 2011 at 08:56 AM

Unity looks for a material with this name in a Folder called Materials next to the scene.

Unity goes up the project folders, looking for the Material in each Materials folder along the way.

It's a "bug" in Unity docs. Unity doesn't search for materials with the same name. It only searches for material which same texture. Which means if you assign MyTexture.png to your material in both Unity and Maya, then Unity will try to link material.

But speaking in general I like using AssetPostprocessor.OnAssignModelMaterial and taking full control of how materials are assigned to models.

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

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

No one has followed this question yet.

Related Questions

Where is the ''extract materials" option? 0 Answers

Exporting fbx from Maya - Pipeline issue 0 Answers

Can material animation be exported from maya and imported into unity ? 1 Answer

Exporting fbx from 3ds max and loading into unity with materials 1 Answer

Problems with materials import from Maya 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