[Request]Example how Materials can be changed in the script
I would like to see an example how I can change material with my own script. I'm thinking of creating some predefined "blocks" and then randomly changing the material to some existing material that I have given in a list. And I want to decide which faces I will replace with the new material.
Does someone have some experience of doing such a thing with SabreCSG? Thanks.
SetAllPolygonsMaterials can be used to set the material of a brush. In this case you would want material_name to be selected from a list of strings which represent materials in your resources folder.
GameObject cubeObject= CSG.CreateBrush(PrimitiveBrushType.Cube, position, size, rotation, null, CSGMode.Add);
PrimitiveBrush activeBrush = cubeObject.GetComponent