Fix latest version button not showing on scene reload
This commit is contained in:
@@ -49,8 +49,7 @@ public class DraggableUI : MonoBehaviour, IDragHandler, IBeginDragHandler
|
|||||||
public void OnEnable()
|
public void OnEnable()
|
||||||
{
|
{
|
||||||
string key = "DraggedUI" + uiName;
|
string key = "DraggedUI" + uiName;
|
||||||
if (PlayerPrefs.HasKey(key) && TryParseVector3(PlayerPrefs.GetString(key), out Vector3 savedPos))
|
if (PlayerPrefs.HasKey(key) && TryParseVector3(PlayerPrefs.GetString(key), out Vector3 savedPos)) transform.localPosition = savedPos;
|
||||||
transform.localPosition = savedPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
|
|||||||
@@ -55,19 +55,19 @@ public class LatestVersionText : MonoBehaviour
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
latest = request.downloadHandler.text;
|
latest = request.downloadHandler.text;
|
||||||
if (updateButton != null) updateButton.gameObject.SetActive(latest != Application.version);
|
|
||||||
}
|
}
|
||||||
RefreshText();
|
RefreshText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshText()
|
public void RefreshText()
|
||||||
{
|
{
|
||||||
if (text == null) return;
|
if (text == null || updateButton == null) return;
|
||||||
if (latest == null)
|
if (latest == null)
|
||||||
text.text = "Latest: Loading...";
|
text.text = "Latest: Loading...";
|
||||||
else if (latest == "-1")
|
else if (latest == "-1")
|
||||||
text.text = "Latest: N/A";
|
text.text = "Latest: N/A";
|
||||||
else
|
else
|
||||||
text.text = "Latest: v" + latest;
|
text.text = "Latest: v" + latest;
|
||||||
|
updateButton.gameObject.SetActive(latest != Application.version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ public class MenuScript : MonoBehaviour
|
|||||||
LatestVersionText.Instance.updateButton = updateButton;
|
LatestVersionText.Instance.updateButton = updateButton;
|
||||||
LatestVersionText.Instance.RefreshText();
|
LatestVersionText.Instance.RefreshText();
|
||||||
|
|
||||||
if (Application.isMobilePlatform || Application.isEditor || Application.platform == RuntimePlatform.WebGLPlayer)
|
if (Application.isMobilePlatform || Application.isEditor)
|
||||||
{
|
{
|
||||||
exitButton.gameObject.SetActive(false);
|
exitButton.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user