public void TestFlexArrayAssetBuildFromMesh() { Vector3[] vertices = new Vector3[] { new Vector3(1, 1, 1), new Vector3(-1, -1, 1), new Vector3(-1, 1, -1), new Vector3(1, -1, -1) }; int[] triangles = new int[] { 0, 2, 1, 0, 1, 3, 0, 3, 2, 1, 2, 3 }; Mesh mesh = new Mesh(); mesh.vertices = vertices; mesh.triangles = triangles; FlexArrayAsset asset = ScriptableObject.CreateInstance <FlexArrayAsset>(); Assert.IsTrue(asset.handle); Assert.AreEqual(0, asset.particles.Length); asset.boundaryMesh = mesh; asset.meshLocalScale = Vector3.one; asset.meshExpansion = 0; asset.particleSpacing = 0.1f; asset.Rebuild(); Assert.IsTrue(asset.handle); Assert.AreEqual(2680, asset.particles.Length); Object.DestroyImmediate(asset); Object.DestroyImmediate(mesh); }
public void TestFlexArrayAssetCreateDestroy() { FlexArrayAsset asset = ScriptableObject.CreateInstance <FlexArrayAsset>(); //Vector4[] particles = new Vector4[] { new Vector4(1, 0, 0, 1), new Vector4(0, 1, 0, 1), new Vector4(0, 0, 1, 1) }; //asset.particles = particles; //Vector4[] checkParticles = asset.particles; //for (int i = 0; i < particles.Length; ++i) // Assert.AreEqual(particles[i], checkParticles[i]); Object.DestroyImmediate(asset); }