Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Discussion Batch-creating materials from selected textures

Discussion in 'Editor & General Support' started by AtomicLugia, Mar 14, 2023.

  1. AtomicLugia

    AtomicLugia

    Joined:
    Aug 15, 2020
    Posts:
    54
    Hi. I'm trying to make a 3D gallery, however, I do have a bunch of pictures as textures, over 100 in fact, and creating one material after another, including naming the material and assign the correct texture, and this over 100 times is just a chore and time-consuming. It even kinda drives me nuts.

    So, is there a script that creates materials for each texture that is selected? Including naming the material after the textures? This would save alot of time and also be such a better solution.

    Thanks in advance!
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,175
    There is no one script, but you can certainly make an editor script for this.

    It's just a case of reading a given number of assets (such as all assets in a folder), looping through them and making a new asset + assign some values for each one, then write those assets to disk.

    I'd start with tutorials on making your own editor windows.