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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    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:
    4,497
    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.