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.

Textures and Meshes

Discussion in 'Scripting' started by marty, Jan 16, 2006.

  1. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Is there a way that I can change (in Unity Javascript, at runtime) the texture/shader applied to a specific face in a mesh?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You can't set the material of a single face at the moment.

    The best way to do this - also in regards to raycasting to get at what you want to modify - is splitting up your mesh in the different parts that you want to apply the material to. Then use

    Code (csharp):
    1.  
    2. renderer.material = someMaterial;
    3. or
    4. renderer.material.texture = someTexture;
    5.  
     
  3. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Thanks, Joe.

    Your solution sounds fine if I only have a few such pieces. But if I need to do it with all of the faces of a mesh, this approach would be unmanagable.

    I'm curious, will there be support for ths functionalty in a future release of Unity? Pre-2.0 maybe?
     
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We are planning to support modifiable meshes in version 1.3 or 1.4.
     
  5. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Great!

    I've posted on this before, but just to make sure, mesh-level access and m odification will be very handy. The ability to build/rebuild meshes at runtime will be even better.

    Thanks.
     
  6. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Oh, and I almost forgot ... related to my concurrent post on changing the texture/shader on a given face ...

    It would be great if I could change the texture/shader of each face, individually, of a mesh.