Pro Builder - boolean removed?

Are the boolean tools on Pro Builder removed? I can’t seem to find them anymore.

1 Like

https://docs.unity3d.com/Packages/com.unity.probuilder@4.2/manual/boolean.html

You mean these?

1 Like

Yeah them. They aren’t in Unity anymore for me. They used to be in experimental section - but they aren’t in it.

Do we have any updates on this? I started using ProBuilder and was wondering how to set a mesh to subtraction mode. I saw a YouTube video talking about this Boolean feature, but I can’t find it in Unity 2019.3.

They are still present, but you have to first enable “Experimental Features” in the ProBuilder preferences.

9 Likes

I want to call the boolean API at runtime

3 Likes

Thanks! I didn’t know Packages could have their own options in the Preferences windows. Now I’m able to access that feature, but I’m getting a StackOverflowException when I try to subtract a cylinder from a cube.

StackOverflowException: The requested operation caused a stack overflow.
System.Collections.Generic.List`1[T].set_Capacity (System.Int32 value) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.List`1[T].EnsureCapacity (System.Int32 min) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.List`1[T].Add (T item) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.ProBuilder.Experimental.CSG.CSG_Plane.SplitPolygon (UnityEngine.ProBuilder.Experimental.CSG.CSG_Polygon polygon, System.Collections.Generic.List`1[T] coplanarFront, System.Collections.Generic.List`1[T] coplanarBack, System.Collections.Generic.List`1[T] front, System.Collections.Generic.List`1[T] back) (at Library/PackageCache/com.unity.probuilder@4.2.1/Runtime/MeshOperations/CSG/Classes/CSG_Plane.cs:89)
UnityEngine.ProBuilder.Experimental.CSG.CSG_Node.Build (System.Collections.Generic.List`1[T] list) (at Library/PackageCache/com.unity.probuilder@4.2.1/Runtime/MeshOperations/CSG/Classes/CSG_Node.cs:112)
UnityEngine.ProBuilder.Experimental.CSG.CSG_Node.Build (System.Collections.Generic.List`1[T] list) (at Library/PackageCache/com.unity.probuilder@4.2.1/Runtime/MeshOperations/CSG/Classes/CSG_Node.cs:128)
(Repeats last line forever)

I won’t be using this anymore since I’ve found a different solution for what I needed to do, but hopefully you can take care of this error in the near future.

3 Likes

Hi, regarding the errors that I’m having too, I started a new thread here for those who want to watch Pro Builder - StackOverflowException with Boolean Tool

1 Like

In case someone was wondering how to enable it go to Edit > Preferences and it’s under ProBuilder

7 Likes

Anyway I can access to the boolean (CSG) features runtime (API)?

The ProBuilder interface to these functions is private, but you could simply use the CSG library directly. See GitHub - karl-/pb_CSG: A C# port of CSG.js by Evan W (http://evanw.github.io/csg.js/)..

On the ProBuilder side, all we’re doing is calling into that library and then re-ProBuilderizing the results. Ex,

            UnityEngine.ProBuilder.Csg.Model result;

            switch (operation)
            {
                case BooleanOperation.Union:
                    result = CSG.Union(lhs.gameObject, rhs.gameObject);
                    break;

                case BooleanOperation.Subtract:
                    result = CSG.Subtract(lhs.gameObject, rhs.gameObject);
                    break;

                default:
                    result = CSG.Intersect(lhs.gameObject, rhs.gameObject);
                    break;
            }

            var materials = result.materials.ToArray();
            ProBuilderMesh pb = ProBuilderMesh.Create();
            pb.GetComponent<MeshFilter>().sharedMesh = (Mesh) result;
            pb.GetComponent<MeshRenderer>().sharedMaterials = materials;
            MeshImporter importer = new MeshImporter(pb.gameObject);
            importer.Import(new MeshImportSettings() { quads = true, smoothing = true, smoothingAngle = 1f });
            pb.Rebuild();
            pb.CenterPivot(null);
            Selection.objects = new Object[] { pb.gameObject };
1 Like

UnityEngine.ProBuilder.Csg is not acceptable. Is there a way to use CSG.Subtract or somehow get access from c# to ProBuilder boolean API in realtime?

6 Likes

Is there a way to you use both packages at the same time? Like I get an error when I am importing the CSG package in addition to ProBuilder. (Assembly with name ‘Unity.Probuilder.Csg’ already exists.)

I am of course aware why the error is triggered but is there also a workaround?

I downloaded the package that @kaarrrllll mentioned and was able to use functions just like the ones provided from Probuilder at runtime as he said. https://github.com/karl-/pb_CSG the github page explains how to use the package and its super straight forward with only a few lines of code. For example you can do things like CSG.Subtract, etc.

You might get errors if you have both the package and probuilder in your project at the same time but I’m sure there are ways to resolve those errors. I personally only needed the CSG package so I didn’t have to go down that route.

This is still a problem… is there a fix ?

I enabled it from preferences. But, when I tried subtracting objects, it crashed the whole Unity 2022.3.

Here are the steps to fix “Assembly with name ‘Unity.Probuilder.Csg’ already exists” issue.

  • Open your project solution in Visual Studio
  • Find Unity.Probuilder.Csg project and rename it to Unity.Standalone.Csg for example9571888--1354555--upload_2024-1-9_18-57-48.png
  • Open Prabox.CSG.asmdef file and rename Unity.Probuilder.Csg to Unity.Standalone.Csg9571888--1354558--upload_2024-1-9_18-59-18.png
  • To fix the same issue for Parabox.CSG.Demo project - open Parabox.CSG.Demo.asmdef file and rename Unity.Probuilder.Csg to Unity.Standalone.Csg
2 Likes