Question by
harisriazgondal · Feb 28 at 01:39 PM ·
scripting problemloadlevel
hy iam using this cript to l;oad next level and drive data from scriptable object and its work fine in editor /play mode but not working in build game /androide or pc
using UnityEngine; using UnityEngine.UI; using UnityEngine.TestTools; using TMPro; using UnityEngine.SceneManagement;
public class MapDisplay : MonoBehaviour { [SerializeField] private TextMeshProUGUI targetDiscription; [SerializeField] private TextMeshProUGUI conDiscription; [SerializeField] private Image targetImage; [SerializeField] private Image mapImage; [SerializeField] private Button playButton; /// [SerializeField] private FixedButton aceptButton; [SerializeField] private GameObject lockIcon;
public void DisplayMap(Map _map)
{
targetDiscription.text = _map.targetDescription;
conDiscription.text = _map.conditionsDescription;
targetImage.sprite = _map.targetImage;
bool mapUnlocked = PlayerPrefs.GetInt("currentScene", 0) >= _map.mapindex;
lockIcon.SetActive(!mapUnlocked);
playButton.interactable = mapUnlocked;
if (mapUnlocked)
targetImage.color = Color.white;
else
targetImage.color = Color.gray;
playButton.onClick.RemoveAllListeners();
playButton.onClick.AddListener(() => SceneManager.LoadScene(_map.SceneToLOad.name));
}
}
Comment