Jump to content
deltamish

Set Material of Selected Face at Runtime

Recommended Posts

Hey,

I know this question has been asked many times but those answer were mainly built around ProBuilder 2 and before Basic and Advanced classification was removed. 

So coming to the point. 

How can I replicate face selective behavior like in ProBuilder 2 runtime example and also have capability of applying different material to selected face at runtime (C#).

Thanks 

cheers ;)

Share this post


Link to post
Share on other sites

How Can I apply pb_Object to mesh generated at runtime ? 

I tried something like this and I get the error as shown below 

Do let me know if I am doing something wrong 

 

ROUGHLY WRITTEN CODE (OT COPY PASTED)
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
pb_Object pbo = cube.AddComponent(typeof(pb_Object));
pbo.Awake();
pbo.ToMesh();
pbo.Refresh();
NullReferenceException: Object reference not set to an instance of an object
ProBuilder.Core.pb_Object.ToMesh (MeshTopology preferredTopology) (at

Thanks 

Share this post


Link to post
Share on other sites
On 3/24/2018 at 3:46 AM, karl said:

You will need to set the vertices and faces of the pb_Object before calling ToMesh and Refresh. Currently the built-in mesh importer is private, but I've made it public for the next update and will include an example here. https://github.com/Unity-Technologies/ProBuilder-API-Examples

 

Hey sorry for the delayed response.

Has the library been updated if so. How can I update to the latest version

 

Thanks 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×