Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Assign material by matching prefixes?

Discussion in 'Scripting' started by jtw, May 20, 2012.

  1. jtw

    jtw

    Joined:
    Jan 21, 2008
    Posts:
    30
    Hi y'all,

    I have a folder with 3d files sorted in a certain order and a folder with textures sorted in the same certain order and their "number" or "prefix" correspond to eachother.

    I was wondering if it's possible to batch assign these automatically with code in Unity? So for every 3d model it finds the corresponding map and assigns it.
    Any hints to how I can achieve this with code would be greatly appreciated.


    Thanks!

    Jacob
     
    Last edited: May 21, 2012
  2. jtw

    jtw

    Joined:
    Jan 21, 2008
    Posts:
    30
    Btw, the 3D models already have texture coordinates and materials, it's just the corresponding texture that needs to be applied.