user2698308
user2698308

Reputation: 145

Unity3d Probuilder scripting. How to apply texture in code?

I am creating primitive probuilder form in code:

m_mesh = ShapeGenerator.GenerateArch(
PivotLocation.FirstVertex,
angle: GetPrceduralParameters.Angle,
radius: GetPrceduralParameters.Radius,
width: GetPrceduralParameters.Thiknes,
depth: GetPrceduralParameters.Length,
radialCuts: GetPrceduralParameters.RadialCuts,
insideFaces: true,
outsideFaces: true,
frontFaces: true,
backFaces: true,
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, or apply without tiling on every face?

Upvotes: 0

Views: 142

Answers (1)

user2698308
user2698308

Reputation: 145

The solution found:

 Smoothing.ApplySmoothingGroups(m_meshConcrete, m_meshConcrete.faces, 90);
 m_meshConcrete.Refresh();

Upvotes: 1

Related Questions