Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Application.GetStreamProgressForLevel

static function GetStreamProgressForLevel(levelIndex: int): float;
static float GetStreamProgressForLevel(int levelIndex);
static def GetStreamProgressForLevel(levelIndex as int) as float

Description

How far has the download progressed? [0...1].

In the webplayer this returns the progress of this level.

See Also: CanStreamedLevelBeLoaded function.

	// Print on a guiText how much has been streamed level at index 1
	// When finished streaming, print "Level 1 has been fully streamed!"
	var percentageLoaded : float = 0;

function Update() { if(Application.GetStreamProgressForLevel(1) == 1) { guiText.text = "Level at index 1 has been fully streamed!"; } else { percentageLoaded = Application.GetStreamProgressForLevel(1) * 100; guiText.text = percentageLoaded.ToString(); } }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public float percentageLoaded = 0;
    void Update() {
        if (Application.GetStreamProgressForLevel(1) == 1)
            guiText.text = "Level at index 1 has been fully streamed!";
        else {
            percentageLoaded = Application.GetStreamProgressForLevel(1) * 100;
            guiText.text = percentageLoaded.ToString();
        }
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public percentageLoaded as float = 0

	def Update() as void:
		if Application.GetStreamProgressForLevel(1) == 1:
			guiText.text = 'Level at index 1 has been fully streamed!'
		else:
			percentageLoaded = (Application.GetStreamProgressForLevel(1) * 100)
			guiText.text = percentageLoaded.ToString()

static function GetStreamProgressForLevel(levelName: string): float;
static float GetStreamProgressForLevel(string levelName);
static def GetStreamProgressForLevel(levelName as string) as float

Description

How far has the download progressed? [0...1].

In the webplayer this returns the progress of this level.

See Also: CanStreamedLevelBeLoaded function.

	// Print on a guiText how much has been streamed "Level1"
	// When finished streaming, print "Level1 has been fully streamed!"
	var percentageLoaded : float = 0;

function Update() { if(Application.GetStreamProgressForLevel("Level1") == 1) { guiText.text = "Level 1 has been fully streamed!"; } else { percentageLoaded = Application.GetStreamProgressForLevel("Level1") * 100; guiText.text = percentageLoaded.ToString(); } }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public float percentageLoaded = 0;
    void Update() {
        if (Application.GetStreamProgressForLevel("Level1") == 1)
            guiText.text = "Level 1 has been fully streamed!";
        else {
            percentageLoaded = Application.GetStreamProgressForLevel("Level1") * 100;
            guiText.text = percentageLoaded.ToString();
        }
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public percentageLoaded as float = 0

	def Update() as void:
		if Application.GetStreamProgressForLevel('Level1') == 1:
			guiText.text = 'Level 1 has been fully streamed!'
		else:
			percentageLoaded = (Application.GetStreamProgressForLevel('Level1') * 100)
			guiText.text = percentageLoaded.ToString()