Fix latest version button not showing on scene reload

This commit is contained in:
2025-07-06 16:34:48 -07:00
parent 8c7210e33f
commit 47c7fc89e8
3 changed files with 4 additions and 5 deletions

View File

@@ -49,8 +49,7 @@ public class DraggableUI : MonoBehaviour, IDragHandler, IBeginDragHandler
public void OnEnable()
{
string key = "DraggedUI" + uiName;
if (PlayerPrefs.HasKey(key) && TryParseVector3(PlayerPrefs.GetString(key), out Vector3 savedPos))
transform.localPosition = savedPos;
if (PlayerPrefs.HasKey(key) && TryParseVector3(PlayerPrefs.GetString(key), out Vector3 savedPos)) transform.localPosition = savedPos;
}
public void Update()

View File

@@ -55,19 +55,19 @@ public class LatestVersionText : MonoBehaviour
else
{
latest = request.downloadHandler.text;
if (updateButton != null) updateButton.gameObject.SetActive(latest != Application.version);
}
RefreshText();
}
public void RefreshText()
{
if (text == null) return;
if (text == null || updateButton == null) return;
if (latest == null)
text.text = "Latest: Loading...";
else if (latest == "-1")
text.text = "Latest: N/A";
else
text.text = "Latest: v" + latest;
updateButton.gameObject.SetActive(latest != Application.version);
}
}

View File

@@ -15,7 +15,7 @@ public class MenuScript : MonoBehaviour
LatestVersionText.Instance.updateButton = updateButton;
LatestVersionText.Instance.RefreshText();
if (Application.isMobilePlatform || Application.isEditor || Application.platform == RuntimePlatform.WebGLPlayer)
if (Application.isMobilePlatform || Application.isEditor)
{
exitButton.gameObject.SetActive(false);
}