public void Dispose() { if (m_Disposed) { return; } renderUtility.Cleanup(); UnityObject.DestroyImmediate(gameObject); gameObject = null; m_Disposed = true; }
public void DestroyPreview() { if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; m_PreviewGrid = null; m_PreviewTilemaps = null; m_PreviewTilemapRenderers = null; } }
void CleanUp() { if (m_previewRenderUtility != null) { m_previewRenderUtility.Cleanup(); m_previewRenderUtility = null; } if (m_previewMesh != null) { Resources.UnloadAsset(m_previewMesh); m_previewMesh = null; } if (m_previewRenderUtility != null) { m_previewRenderUtility.Cleanup(); m_previewRenderUtility = null; } m_material = null; }
public void OnDisable() { if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; } if (m_WireMaterial) { DestroyImmediate(m_WireMaterial, true); } }
public void OnDisable() { if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; } if (timeControl != null) { timeControl.OnDisable(); } }
private void OnDisable() { m_Settings?.Dispose(); if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; DestroyImmediate(m_ShadedMesh, true); DestroyImmediate(m_GeometryMesh, true); m_GeometryMaterial = null; } }
public void OnDisable() { if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; } if (m_Settings != null) { DestroyImmediate(m_Settings.shadedPreviewMaterial); DestroyImmediate(m_Settings.wireMaterial); DestroyImmediate(m_Settings.meshMultiPreviewMaterial); DestroyImmediate(m_Settings.lineMaterial); } }
private void OnDisable() { if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; DestroyImmediate(m_ShadedMesh, true); DestroyImmediate(m_GeometryMesh, true); m_GeometryMaterial = null; if (m_WireframeMaterial != null) { DestroyImmediate(m_WireframeMaterial, true); } } }
public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height) { if (!ShaderUtil.hardwareSupportsRectRenderTexture || !SystemInfo.supports2DArrayTextures) { return(null); } var texture = target as Texture2DArray; if (texture == null) { return(null); } var previewUtility = new PreviewRenderUtility(); previewUtility.BeginStaticPreview(new Rect(0, 0, width, height)); InitPreview(); m_Material.mainTexture = texture; m_Material.SetInt(s_ShaderColorMask, 15); m_Material.SetFloat(s_ShaderMip, 0); m_Material.SetInt(s_ShaderToSrgb, 0); m_Material.SetInt(s_ShaderIsNormalMap, IsNormalMap(texture) ? 1 : 0); int sliceDistance = previewUtility.renderTexture.width / 12; var elementCount = Mathf.Min(texture.depth, 6); Rect screenRect = new Rect(), sourceRect = new Rect(); var subRect = new Rect(0, 0, previewUtility.renderTexture.width - sliceDistance * (elementCount - 1), previewUtility.renderTexture.height - sliceDistance * (elementCount - 1)); for (var el = elementCount - 1; el >= 0; --el) { m_Material.SetInt(s_ShaderSliceIndex, el); subRect.x = sliceDistance * el; subRect.y = previewUtility.renderTexture.height - subRect.height - sliceDistance * el; var aspect = texture.width / (float)texture.height; GUI.CalculateScaledTextureRects(subRect, ScaleMode.ScaleToFit, aspect, ref screenRect, ref sourceRect); Graphics.DrawTexture(screenRect, texture, sourceRect, 0, 0, 0, 0, Color.white, m_Material); } var res = previewUtility.EndStaticPreview(); previewUtility.Cleanup(); return(res); }
public void OnDisable() { // This check is necessary because the order of OnEnable/OnDisable varies depending on whether the inspector is embedded in the project browser or object selector. if (m_PlayingInspector == this) { AudioUtil.StopAllClips(); m_PlayingClip = null; } EditorPrefs.SetBool("AutoPlayAudio", m_bAutoPlay); if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; } }
public void OnDisable() { if (s_PlayingInstance == this) { AudioUtil.StopAllClips(); s_PlayingInstance = null; } EditorPrefs.SetBool("AutoPlayAudio", s_AutoPlay); if (m_PreviewUtility != null) { m_PreviewUtility.Cleanup(); m_PreviewUtility = null; } m_HandleLinesMaterial = null; }