Home Unity

Unity - assigning mats to meshes?

polycounter lvl 9
Offline / Send Message
Blitzwood polycounter lvl 9
Hello,

I've been working with UE4 over the past years and now I'm a bit lost trying to convert a scene to Unity.

How do I set materials to a mesh that has no material in the inspector and is shown as white by default in the assets list?

I can't find Unity's way of doing this other than draging and droping materials to a mesh already placed on the scene.

]

Replies

  • kio
    Options
    Offline / Send Message
    kio polycounter lvl 15
    well, i think you have to turn on "import materials" and then assign textures to those generated materials - you can tweak the importing behaviour on the fbx. id suggest to just use the model materials name and recursive up search.
    Another way would be to just drop the imported mesh into the scene slap a material on it and create a prefab out of it.
    The first approach forces you to tidy up your materials, as it will just import whatever it has assigned - the later is a little more elaborate as you always have to do that by yourself, but most of the times you'll find yourself doing that anyways for adding scripts / fx etc.

    A more advanced approach would be to hook up a script into the asset postprocessor - and do some logic there, this is actually pretty powerful but might be out of your scope.
  • weareape
    Options
    Offline / Send Message
    weareape polycounter lvl 7
    so to reiterate what was said above; the way unity works is that you import an fbx, drag it into scene, apply materials to the mesh renderer component, then drag back into your project as a new prefab. then whenever you make a change to that new prefab in scene you can 'apply' it to the prefab in your project folder. this way it will update any of that prefab across your project.

    wether you choose to import materials on fbx or uncheck that and change in scene is whatever works best for you.
  • Blitzwood
    Options
    Offline / Send Message
    Blitzwood polycounter lvl 9
    I see! Thank you very much Kio and Weareape! The solution is actually that simple but I could not find it anywhere in the documentation.

    Thank you once again.
    @kio @weareape
  • Blitzwood
    Options
    Offline / Send Message
    Blitzwood polycounter lvl 9
    Can I delete the .fbx from the project after I have created a prefab or should I keep it anyway?
  • weareape
    Options
    Offline / Send Message
    weareape polycounter lvl 7
    no. it's tied to that prefab and any new prefab you may create from it and is what you update if you ever have to fix anything on the mesh itself. you can see where it is tied to the prefab on the mesh filter component. if you're used to ue4 this might help in reverse https://docs.unrealengine.com/latest/INT/GettingStarted/FromUnity/
Sign In or Register to comment.