Hello All,
i’m a newbie in C# script
i have a problem here, i have download loading scripts it’s works fine in original *.unitypackage File!, but it’s always have an error, if the script i using it in my project. What’s the problem??!
i have checked the script manually and 'its same. No different at all. Can anybody help me? Thanks in advance (^-^)
here my scripts :
using UnityEngine;
using System.Collections;
public class LoadingAWScript : MonoBehaviour
{
public GUITexture LoadingTexture;
public Texture[] LoadingTextures;
private AsyncOperation loadscene;
private float StreamProgress = 0.0f;
// Use this for initialization
void Start ()
{
LoadingTexture.texture = LoadingTextures[0];
loadscene = Application.LoadLevelAsync("MainScene");
}
// Update is called once per frame
void Update ()
{
StreamProgress = loadscene.progress;
if ( StreamProgress <= 0.0f)
LoadingTexture.texture = LoadingTextures[0];
if ( StreamProgress > 0.0f && StreamProgress <= 0.1f)
LoadingTexture.texture = LoadingTextures[1];
if ( StreamProgress > 0.1f && StreamProgress <= 0.2f)
LoadingTexture.texture = LoadingTextures[2];
if ( StreamProgress > 0.2f && StreamProgress <= 0.3f)
LoadingTexture.texture = LoadingTextures[3];
if ( StreamProgress > 0.3f && StreamProgress <= 0.4f)
LoadingTexture.texture = LoadingTextures[4];
if ( StreamProgress > 0.4f && StreamProgress <= 0.5f)
LoadingTexture.texture = LoadingTextures[5];
if ( StreamProgress > 0.5f && StreamProgress <= 0.6f)
LoadingTexture.texture = LoadingTextures[6];
if ( StreamProgress > 0.6f && StreamProgress <= 0.7f)
LoadingTexture.texture = LoadingTextures[7];
if ( StreamProgress > 0.7f && StreamProgress <= 0.8f)
LoadingTexture.texture = LoadingTextures[8];
if ( StreamProgress > 0.8f && StreamProgress <= 0.9f)
LoadingTexture.texture = LoadingTextures[9];
if ( StreamProgress > 0.9f && StreamProgress <= 1.0f)
LoadingTexture.texture = LoadingTextures[10];
}
}