您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

30 行
981 B

using UnityEngine;
using UnityEngine.SceneManagement;
namespace UnityConsole.Commands
{
public static class UnloadSceneCommand
{
public static readonly string name = "UnloadScene";
public static readonly string description = "Unloads the named scene";
public static readonly string usage = "UnloadScene sceneName";
public static ConsoleCommandResult Execute(params string[] args)
{
if (args.Length == 0)
{
return HelpCommand.Execute(name);
}
return UnloadScene(args[0]);
}
private static ConsoleCommandResult UnloadScene(string sceneName)
{
SceneManager.UnloadSceneAsync(sceneName);
Resources.UnloadUnusedAssets();
return ConsoleCommandResult.Succeeded(
"Scene may or may not have unloaded - a Unity API change makes this hard to tell!.");
}
}
}