public static IsLoadingAssetPreview ( int instanceID ) : bool | ||
instanceID | int | InstanceID of the assset that a preview has been requested for by: AssetPreview.GetAssetPreview(). |
return | bool |
internal virtual void OnHeaderIconGUI(Rect iconRect) { Texture2D icon = null; if (!HasPreviewGUI()) { // Fetch isLoadingAssetPreview to ensure that there is no situation where a preview needs a repaint because it hasn't finished loading yet. bool isLoadingAssetPreview = AssetPreview.IsLoadingAssetPreview(target.GetInstanceID()); icon = AssetPreview.GetAssetPreview(target); if (!icon) { // We have a static preview it just hasn't been loaded yet. Repaint until we have it loaded. if (isLoadingAssetPreview) { Repaint(); } icon = AssetPreview.GetMiniThumbnail(target); } } if (HasPreviewGUI()) { // OnPreviewGUI must have all events; not just Repaint, or else the control IDs will mis-match. OnPreviewGUI(iconRect, Styles.inspectorBigInner); } else if (icon) { GUI.Label(iconRect, icon, Styles.centerStyle); } }
internal virtual void OnHeaderIconGUI(Rect iconRect) { if (Editor.s_Styles == null) { Editor.s_Styles = new Editor.Styles(); } Texture2D texture2D = null; if (!this.HasPreviewGUI()) { bool flag = AssetPreview.IsLoadingAssetPreview(this.target.GetInstanceID()); texture2D = AssetPreview.GetAssetPreview(this.target); if (!texture2D) { if (flag) { this.Repaint(); } texture2D = AssetPreview.GetMiniThumbnail(this.target); } } if (this.HasPreviewGUI()) { this.OnPreviewGUI(iconRect, Editor.s_Styles.inspectorBigInner); } else if (texture2D) { GUI.Label(iconRect, texture2D, Editor.s_Styles.centerStyle); } }
internal virtual void OnHeaderIconGUI(Rect iconRect) { if (s_Styles == null) { s_Styles = new Styles(); } Texture2D image = null; if (!this.HasPreviewGUI()) { bool flag = AssetPreview.IsLoadingAssetPreview(this.target.GetInstanceID()); image = AssetPreview.GetAssetPreview(this.target); if (image == null) { if (flag) { this.Repaint(); } image = AssetPreview.GetMiniThumbnail(this.target); } } if (this.HasPreviewGUI()) { this.OnPreviewGUI(iconRect, s_Styles.inspectorBigInner); } else if (image != null) { GUI.Label(iconRect, image, s_Styles.centerStyle); } }
private Texture GetAssetPreviewTexture() { bool flag = AssetPreview.IsLoadingAssetPreview(base.target.GetInstanceID()); Texture texture = AssetPreview.GetAssetPreview(base.target); if (!texture) { if (flag) { GUIView.current.Repaint(); } texture = AssetPreview.GetMiniThumbnail(base.target); } return(texture); }
Texture GetAssetPreviewTexture() { Texture tex = null; bool isLoadingAssetPreview = AssetPreview.IsLoadingAssetPreview(target.GetInstanceID()); tex = AssetPreview.GetAssetPreview(target); if (!tex) { // We have a static preview it just hasn't been loaded yet. Repaint until we have it loaded. if (isLoadingAssetPreview) { GUIView.current.Repaint(); } tex = AssetPreview.GetMiniThumbnail(target); } return(tex); }
internal virtual void OnHeaderIconGUI(Rect iconRect) { Texture2D icon = null; // Fetch isLoadingAssetPreview to ensure that there is no situation where a preview needs a repaint because it hasn't finished loading yet. bool isLoadingAssetPreview = AssetPreview.IsLoadingAssetPreview(target.GetInstanceID()); icon = AssetPreview.GetAssetPreview(target); if (!icon) { // We have a static preview it just hasn't been loaded yet. Repaint until we have it loaded. if (isLoadingAssetPreview) Repaint(); icon = AssetPreview.GetMiniThumbnail(target); } GUI.Label(iconRect, icon, BaseStyles.centerStyle); }
/// <summary> /// <para>Loading previews is asynchronous so it is useful to know if a specific asset preview is in the process of being loaded so client code e.g can repaint while waiting for the loading to finish.</para> /// </summary> /// <param name="instanceID">InstanceID of the assset that a preview has been requested for by: AssetPreview.GetAssetPreview().</param> public static bool IsLoadingAssetPreview(int instanceID) { return(AssetPreview.IsLoadingAssetPreview(instanceID, 0)); }