In Unity 5 it is recommended to turn off continuous baking of lightmaps by going to the menu and navigating to Window/Lighting/Lightmaps and unchecking the checkbox. This will prevent lag and stuttering in the editor.
Latest addition to the collection: Prefab Maker
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menuusing UnityEngine;
using System.Collections;
using System.Collections.Generic;
using CSG;
public class Test : MonoBehaviour
{
public enum Operation { Subtract, Union, Intersection };
List<Polygon> origPolygons;
GameObject gameObjectA;
GameObject gameObjectB;
Transform[] childs = new Transform[2];
public Operation operation = Operation.Subtract;
// Use this for initialization
void Start ()
{
gameObjectA = GameObject.Find("Target");
gameObjectB = GameObject.Find("Brush");
childs[0] = gameObjectA.transform;
childs[1] = gameObjectB.transform;
origPolygons = new List<Polygon>();
CSG.CSG.triIndex = 0; // always set this to zero before all operations
CSG.CSG.transform = gameObjectA.transform;
CSG.CSG A = CSG.CSG.fromMesh(childs[0].GetComponent<MeshFilter>().sharedMesh, childs[0], true);
CSG.CSG B = CSG.CSG.fromMesh(childs[1].GetComponent<MeshFilter>().sharedMesh, childs[1], false);
origPolygons.AddRange(A.polygons);
origPolygons.AddRange(B.polygons);
CSG.CSG result = null;
if (operation == Operation.Subtract)
{
result = A.subtract(B);
}
if (operation == Operation.Union)
{
result = A.union(B);
}
if (operation == Operation.Intersection)
{
result = A.intersect(B);
}
if (result != null)
{
result.toMesh(gameObjectA, gameObjectB);
}
}
// Update is called once per frame
void Update ()
{
}
}