private Texture2D GenerateTagTexture(TagInfo info, int idx) { Texture2D texture = null; for (int i = idx; i < idx + 10; ++i) { HierarchyFrameDataView hierarchyFrameDataView = ProfilerDriver.GetHierarchyFrameDataView(i, 0, HierarchyFrameDataView.ViewModes.Default, 0, false); if (hierarchyFrameDataView == null) { continue; } NativeArray <byte> bytes = hierarchyFrameDataView.GetFrameMetaData <byte>(ScreenShotToProfiler.MetadataGuid, info.id); if (bytes.IsCreated && bytes.Length > 16) { texture = new Texture2D(info.width, info.height, TextureFormat.RGBA32, false); texture.LoadRawTextureData(bytes); texture.Apply(); break; } } return(texture); }
private void Reflesh(int frameIdx, bool force = false) { if (lastPreviewFrameIdx == frameIdx && !force) { return; } HierarchyFrameDataView hierarchyFrameDataView = ProfilerDriver.GetHierarchyFrameDataView(frameIdx, 0, HierarchyFrameDataView.ViewModes.Default, 0, false);; NativeArray <byte> bytes = hierarchyFrameDataView.GetFrameMetaData <byte>(ScreenShotToProfiler.MetadataGuid, ScreenShotToProfiler.InfoTag); if (bytes != null && bytes.Length >= 12) { var tagInfo = GenerateTagInfo(bytes); SetOutputSize(tagInfo); if (originTexture) { Object.DestroyImmediate(originTexture); } originTexture = GenerateTagTexture(tagInfo, frameIdx); //this.drawTextureInfo.SetupToRenderTexture(originTexture); } else { //this.drawTextureInfo.SetupToRenderTexture(null); if (originTexture) { Object.DestroyImmediate(originTexture); } originTexture = null; } lastPreviewFrameIdx = frameIdx; }