Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Announcing Material Merger!

Discussion in 'Assets and Asset Store' started by nockieboy, Jun 7, 2014.

  1. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48


    Streamline your Project!
    Material Merger is an Editor tool that will speed up optimisation of your project and reduce the overall size of your project by drastically reducing the number of duplicate or similar materials being used by your assets.

    Do you find that whenever you import a new 3D asset into Unity, you end up with lots of materials - some of which are the same colour/properties as other materials already in use in the project?

    I have certainly found this - in fact, my current project had over 1,300 materials! There were countless blacks, whites, reds etc. and even more similar shades. So I wrote Material Merger to scan through the project and identify materials using the same shaders that all shared the same (or similar) properties and replaced the duplicate materials in all game assets in my project.

    Material Merger was able to replace and delete over 400 materials by removing unnecessary duplicates!!

    And it can do the same for you. If you find your project burgeoning under the strain of so many materials and can't face the daunting task of find duplicates and reassigning them across countless renderers, then let Material Merger do the hard work for you!

    Versatile
    You can specify exact matching (only identical materials will be merged) or fuzzy matching where you specify the tolerance of the matching across any or all properties, from RGB to Alpha and Specularity. Material Merger even checks materials for matching textures, offsets and scales before deciding if their duplicates or not.

    Material Merger supports all the most commonly used shaders - if you want it to support others, just let me know!



    If you have any problems, don't hesitate to contact me (especially if you use a Mac as I'm unable to test on them!)

    Jon

    10103
     
  2. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48
    Note: Will soon be updating to include support for Macs.
     
  3. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48
    Version 1.1 has just been submitted to the Asset Store!

    • Bug fixed causing Material Merger to halt if a null or corrupt prefab existed in the project
    • Material Merger settings are now persistent across the Unity session - closing the window no longer causes Material Merger to forget its settings (until you close Unity)
    • Added Target Folders, which work in the opposite way to Protected Folders, allowing you to specify a folder or folders for Material Merger to restrict its operations to
    • Added 'clear list' buttons to Protected and Target Folder menu items, so you can clear the list if you've made a mistake and added the wrong folder
    • Material Merger now highlights the material asset in question when prompting you if you want to delete a duplicate material, aiding in identification of exactly which material it's asking you about

    This update was as the result of customer feedback and has been completed and submitted to the Asset Store within 48 hours of first contact. ;)
     
  4. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48
    Also fully Unity 5-compliant with the new shaders.
     
  5. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    194
    This work with the current version of Unity?
     
  6. AnG3333L

    AnG3333L

    Joined:
    Aug 4, 2017
    Posts:
    1
    Hey,

    I am using the plugin with Unity2017 for cleaning up materials in assets which were exported from CAD software. It does the great job in removing the duplicate materials but doesn't substitute all the materials in the scene and leave some of them empty (removed). So I have to manually substitutes the missing ones. Is it a bug in the plugin or something wrong at my end?
     

    Attached Files:

  7. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48
    Yes, it works with all versions of Unity - always with the caveat that Unity might change something in a new update that could break how Material Merger works, so if you ever have any trouble don't hesitate to contact me so I can update it.

    Talking of contacting me, as you can see I don't check this forum anywhere near as often as I should do - but you can always get hold of me through the website contact page.

    As for your question, @AnG3333L, it's a common problem caused by users not clicking 'YES' when Unity prompts them to save the current scene before loading the next one. Material Merger works on ALL scenes in the project; to do so, it makes changes to current scene then loads the next one. Naturally, the changes need to be saved to the current scene before loading the next one and if you don't click yes at the prompt, those material swaps are lost. When the duplicate materials are deleted at the end, unsaved scenes will be still be referencing them and you'll hit the issue where you end up with objects that have no materials.

    TL;DR: Always click 'YES' to the 'save scene' prompt! ;)
     
  8. nockieboy

    nockieboy

    Joined:
    Jul 7, 2012
    Posts:
    48
    Quick update to let you know that update 1.4 for Material Merger is awaiting checking by the Unity Asset Store and will be available shortly as a free upgrade to existing users.

    1.4 includes some important changes - not least of which is the ability to identify the presence of ModelPrefabInstances in a scene and convert them into User Prefabs. This is important because changes made to a ModelPrefabInstance by a script don't seem to be saved by Unity - resulting in dreaded pink materials if you have Delete Duplicates enabled.

    There are a number of other updates as well, including the ability to identify prefab types in the scene and clear a selected folder of unused materials. These are the beginnings of wider project-management tools that will be coming to Material Merger in the future!
     
unityunity