Search Unity

Texture Swapping?

Discussion in 'Editor & General Support' started by zquirp, Mar 23, 2008.

  1. zquirp

    zquirp

    Joined:
    Nov 21, 2007
    Posts:
    2
    I was wondering if there is a way for the end-user to swap out a texture.

    Let's say there is an object in the game. I would like the end-user to have
    the capability to click a button, select a texture from their system and
    have that object update it's texture on the fly. Or, have that texture on
    the object at load.

    (I have already written a small program that will take care of scale, dpi,
    CMYK to RGB, translate to JPEG, write to a predetermined folder.)

    Is this feasible or am I just dreaming?

    thanks in advance for any help
     
  2. drag0nsphere

    drag0nsphere

    Joined:
    Nov 7, 2007
    Posts:
    285
    would this work?

    Code (csharp):
    1.  
    2. renderer.material.texture
    3.  
     
  3. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    Look for discussions of using the WWW class to load an external image, both here on the forum and in the documentation.

    And then, yes, you can swap the texture the renderer uses under script control.
     
  4. KenManiac

    KenManiac

    Joined:
    Mar 22, 2008
    Posts:
    1
    i work with the OP, for the record.

    When you build a project in Unity, the assets get bundled and protected. Is it possible to write to this protected bundle after it's built?

    Can it be written to by an external app as well?

    How protected are these bundles? Could assets be 'liberated'?

    The scenario is like zquirp first described. After the project is built and protected, there will be a script to swap specific art that gets loaded onto specific structures. If nobody could do this 'by hand' (in the Finder or winExplorer) that would be a bonus.

    Using a folder external to the bundled package would work fine, perhaps recycling some web scripts to access it.

    We built this in Torque already and would like to move on/up to Unity, but this concern is central to this project.

    I must confess that we are just beginning to learn Unity, so if these are obvious questions, bear with us.