/// <summary> /// Checks the current state of import and updates the GUI elements accordingly. /// </summary> internal void Update() { bool isImporting = ProjectLibrary.GetImportProgress(path) < 1.0f; guiSpinner.Active = isImporting; reimportButton.Active = !isImporting; }
/// <summary> /// Creates the reimport GUI elements in the provided layout. /// </summary> /// <param name="path">Path of the resource that can be reimported.</param> /// <param name="parent">Parent GUI layout to which to add the reimport GUI elements.</param> /// <param name="doReimport">User provided callback that triggers when the reimport button is clicked.</param> internal GUIReimportButton(string path, GUILayout parent, Action doReimport) { this.path = path; reimportButton.OnClick += () => doReimport(); GUILayout reimportButtonLayout = parent.AddLayoutX(); reimportButtonLayout.AddFlexibleSpace(); reimportButtonLayout.AddElement(reimportButton); reimportButtonLayout.AddElement(guiSpinner); bool isImporting = ProjectLibrary.GetImportProgress(path) < 1.0f; guiSpinner.Active = isImporting; reimportButton.Active = !isImporting; }