private void OnDestroy() { if (q != null) { q.Dispose(); } }
void OnDestroy() { if (texture != null) { Destroy(texture); texture = null; } if (q != null) { q.Dispose(); } }
private void OnStopStreaming() { Source.OnNewSample -= OnNewSample; if (q != null) { q.Dispose(); q = null; } }
private void OnStopStreaming() { source.OnNewSample -= OnNewSample; if (q != null) { q.Dispose(); q = null; } if (handle.IsAllocated) { handle.Free(); } }
void OnDestroy() { if (_colorQueue != null) { _colorQueue.Dispose(); _colorQueue = null; } if (_pointQueue != null) { _pointQueue.Dispose(); _pointQueue = null; } if (_colorBuffer != null) { _colorBuffer.Dispose(); _colorBuffer = null; } if (_positionBuffer != null) { _positionBuffer.Dispose(); _positionBuffer = null; } if (_remapBuffer != null) { _remapBuffer.Dispose(); _remapBuffer = null; } if (_tempColorMap != null) { Destroy(_tempColorMap); _tempColorMap = null; } if (_tempPositionMap != null) { Destroy(_tempPositionMap); _tempPositionMap = null; } }
private void ResetMesh(int width, int height) { Assert.IsTrue(SystemInfo.SupportsTextureFormat(TextureFormat.RGFloat)); uvmap = new Texture2D(width, height, TextureFormat.RGFloat, false, true) { wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Point, }; GetComponent <MeshRenderer>().sharedMaterial.SetTexture("_UVMap", uvmap); if (mesh != null) { mesh.Clear(); } else { mesh = new Mesh() { indexFormat = IndexFormat.UInt32, } }; vertices = new Vector3[width * height]; var indices = new int[vertices.Length]; for (int i = 0; i < vertices.Length; i++) { indices[i] = i; } mesh.MarkDynamic(); mesh.vertices = vertices; var uvs = new Vector2[width * height]; Array.Clear(uvs, 0, uvs.Length); for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { uvs[i + j * width].x = i / (float)width; uvs[i + j * width].y = j / (float)height; } } mesh.uv = uvs; mesh.SetIndices(indices, MeshTopology.Points, 0, false); mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 10f); GetComponent <MeshFilter>().sharedMesh = mesh; } void OnDestroy() { if (q != null) { q.Dispose(); q = null; } if (mesh != null) { Destroy(null); } }