I create a loadscreen and clicking to play I get this error: Error cs0119 expression denotes a type’ where a variable’ value’ or method group’ was expected.
Can help me?
Mi Script in C#:
using UnityEngine;
using System.Collections;
public class LoadingScreen : MonoBehaviour {
public string LevelToLoad;
public GameObject background;
public GameObject text;
public GameObject progressBar;
int loadProgress = 0;
// Use this for initialization
void Start () {
background.SetActive (false);
text.SetActive (false);
progressBar.SetActive (false);
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown ("space")) {
StartCoroutine(DisplayLoadingScreen(LevelToLoad));
}
}
IEnumerator DisplayLoadingScreen(string level){
background.SetActive (true);
text.SetActive (true);
progressBar.SetActive (true);
progressBar.transform.localScale = new Vector3(LoadProgress, progressBar.transform.localScale.y, progressBar.transform.localScale.z);
text.guiText.text = "Loading Progress " + loadProgress + "%";
AsyncOperation async = Application.LoadLevelAsync (level);
while(!async.isDone){
loadProgress = (int)(async.progress * 100);
text.guiText.text = "Loading Progress " + loadProgress + "%";
progressBar.transform.localScale = new Vector3(async.progress, progressBar.transform.localScale.y, progressBar.transform.localScale.z);
yield return null;
}
}
}