void SeperateRegion(List <Vector2Int> region) { //takes a list of tile points and removes it from the current map while creating a new clump with the removed tile values. float[,] newMap = new float[size, size]; foreach (Vector2Int tile in region) { newMap[tile.x, tile.y] = map[tile.x, tile.y]; map[tile.x, tile.y] = 0f; } GameObject newClump = new GameObject(); newClump.transform.position = transform.position; newClump.transform.rotation = transform.rotation; newClump.AddComponent <ClumpMeshGenerator>(); newClump.GetComponent <MeshRenderer>().material = GetComponent <MeshRenderer>().material; newClump.AddComponent <Rigidbody2D>(); ClumpGenerator newClumpGen = newClump.AddComponent <ClumpGenerator>(); newClumpGen.size = size; newClumpGen.SetMap(newMap); newClumpGen.CalculateMass(); ProcessMap(); newClumpGen.ProcessMap(); }