public void makeCloud()
    {
        var data = new TC.PointCloudData();

        data.Initialize(cloud.pPosition, cloud.pNormals, cloud.pColours, 1, new Vector3(), new Vector3());
        data.name = CloudName;


        var system = gameObject.AddComponent <TCParticleSystem>();

        system.Emitter.Shape      = EmitShapes.PointCloud;
        system.Emitter.PointCloud = data;
        system.Emitter.SetBursts(new[] { new BurstEmission {
                                             Time = 0, Amount = data.PointCount
                                         } });
        system.Emitter.EmissionRate = 0;
        system.Emitter.Lifetime     = MinMaxRandom.Constant(-1.0f);
        system.Looping              = false;
        system.MaxParticles         = data.PointCount + 1000;
        system.Emitter.Size         = MinMaxRandom.Constant(cloud.cloudInfo.minVoxelSize);
        system.Manager.NoSimulation = true;

        if (data.Normals != null)
        {
            system.ParticleRenderer.pointCloudNormals = true;
            system.ParticleRenderer.RenderMode        = GeometryRenderMode.Mesh;

            var quadGo = GameObject.CreatePrimitive(PrimitiveType.Quad);
            system.ParticleRenderer.Mesh = quadGo.GetComponent <MeshFilter>().sharedMesh;
            DestroyImmediate(quadGo);
        }

        system.enabled = true;
    }
    void makePointCloudData()
    {
        if (writtenAverages == 1)
        {
            writtenAverages = 2;

            Debug.Log("making asset...");
            List <Vector3> pos = new List <Vector3>();
            List <Color32> col = new List <Color32>();
            List <Vector3> nor = new List <Vector3>();
            List <Vector3> sFi = new List <Vector3>();

            //int totalSize = 0;
            foreach (var bucket in sharedData)
            {
                pos.Concat(bucket.Value.Select(item => new Vector3((float)item.Value[0], (float)item.Value[1], (float)item.Value[2])).ToList());
                col.Concat(bucket.Value.Select(item => new Color32((byte)item.Value[3], (byte)item.Value[4], (byte)item.Value[5], 0)).ToList());
                nor.Concat(bucket.Value.Select(item => new Vector3((float)item.Value[item.Value.Length - 4], (float)item.Value[item.Value.Length - 5], (float)item.Value[item.Value.Length - 6])).ToList());
                sFi.Concat(bucket.Value.Select(item => new Vector3((float)item.Value[9], (float)item.Value[12], (float)item.Value[13])).ToList());
            }

            Debug.Log(string.Format("nPosition: {0}\nnColour: {1}\nnnormal: {2}", pos.Count, col.Count, nor.Count));
            Debug.Log("combined position, colour and normals...Now making asset");
            //var data = ScriptableObject.CreateInstance<TC.PointCloudData>();

            TC.PointCloudData asset = ScriptableObject.CreateInstance <TC.PointCloudData>();
            asset.Initialize(pos.ToArray(), nor.ToArray(), col.ToArray(), 1, new Vector3(), new Vector3());
            asset.name = "TestCloud0001";

            string path = "Assets/Large Files";// Application.dataPath + "/Large Files";
            if (path == "")
            {
                path = "Assets";
            }
            else if (Path.GetExtension(path) != "")
            {
                //    path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
            }

            string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/TestSave001" + ".asset");

            AssetDatabase.CreateAsset(asset, assetPathAndName);

            AssetDatabase.SaveAssets();
            // AssetDatabase.Refresh();

            //renderedCloud = new TC.PointCloudData();
            //renderedCloud.Initialize(pos.ToArray(), nor.ToArray(), col.ToArray(), 1, new Vector3(), new Vector3());
            // renderedCloud.name = "TestCloud0001";
            //return renderedCloud;
        }
    }
    void makeAssetFile()
    {
        TC.PointCloudData asset = ScriptableObject.CreateInstance <TC.PointCloudData>();

        string path = Application.dataPath + "/Large Files";

        if (path == "")
        {
            path = "Assets";
        }
        else if (Path.GetExtension(path) != "")
        {
            //    path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
        }

        string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/TestSave001" + ".asset");

        AssetDatabase.CreateAsset(asset, assetPathAndName);

        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        //  EditorUtility.FocusProjectWindow();
        // Selection.activeObject = asset;
    }