Search Unity

Probuilder scripting. How to texture?

Discussion in 'World Building' started by demozbox, Apr 9, 2020.

  1. demozbox

    demozbox

    Joined:
    Nov 26, 2014
    Posts:
    83
    I creating primitive probuilder form in code:
    Code (CSharp):
    1.   m_mesh = ShapeGenerator.GenerateArch(
    2.                 PivotLocation.FirstVertex,
    3.                 angle: GetPrceduralParameters.Angle,
    4.                 radius: GetPrceduralParameters.Radius,
    5.                 width: GetPrceduralParameters.Thiknes,
    6.                 depth: GetPrceduralParameters.Length,
    7.                 radialCuts: GetPrceduralParameters.RadialCuts,
    8.                 insideFaces: true,
    9.                 outsideFaces: true,
    10.                 frontFaces: true,
    11.                 backFaces: true,
    12.                 endCaps: true);
    Then I want to put a material on it :
    m_mesh.GetComponent<MeshRenderer>().sharedMaterial = m_elementMaterial;


    And texture is tiled. The separate texture is on every face.


    how to stratch the texture?
     
  2. demozbox

    demozbox

    Joined:
    Nov 26, 2014
    Posts:
    83
    the screenshot
     
  3. demozbox

    demozbox

    Joined:
    Nov 26, 2014
    Posts:
    83
    The solution found:
    Smoothing.ApplySmoothingGroups(m_meshConcrete, m_meshConcrete.faces, 90);
    m_meshConcrete.Refresh();