You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
10 years ago
|
using UnityEngine;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
|
||
10 years ago
|
namespace Fungus
|
||
10 years ago
|
{
|
||
10 years ago
|
[CommandInfo("Scripting",
|
||
|
"Load Scene",
|
||
10 years ago
|
"Loads a new Unity scene and displays an optional loading image. This is useful " +
|
||
10 years ago
|
"for splitting a large game across multiple scene files to reduce peak memory " +
|
||
10 years ago
|
"usage. Previously loaded assets will be released before loading the scene to free up memory." +
|
||
10 years ago
|
"The scene to be loaded must be added to the scene list in Build Settings.")]
|
||
10 years ago
|
public class LoadScene : Command
|
||
10 years ago
|
{
|
||
10 years ago
|
[Tooltip("Name of the scene to load. The scene must also be added to the build settings.")]
|
||
10 years ago
|
public string sceneName = "";
|
||
|
|
||
10 years ago
|
[Tooltip("Image to display while loading the scene")]
|
||
10 years ago
|
public Texture2D loadingImage;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
SceneLoader.LoadScene(sceneName, loadingImage);
|
||
|
}
|
||
|
|
||
|
public override string GetSummary()
|
||
|
{
|
||
|
if (sceneName.Length == 0)
|
||
|
{
|
||
|
return "Error: No scene name selected";
|
||
|
}
|
||
|
|
||
|
return sceneName;
|
||
|
}
|
||
10 years ago
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(235, 191, 217, 255);
|
||
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|