WuhuIslandTesting/Library/PackageCache/com.unity.addressables@1.21.12/Tests/Editor/DocExampleCode/LoadScene.cs

29 lines
708 B
C#
Raw Normal View History

2025-01-07 02:06:59 +01:00
namespace AddressableAssets.DocExampleCode
{
#region doc_Load
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
internal class LoadSceneByAddress : MonoBehaviour
{
public string key; // address string
private AsyncOperationHandle<SceneInstance> loadHandle;
void Start()
{
loadHandle = Addressables.LoadSceneAsync(key, LoadSceneMode.Additive);
}
void OnDestroy()
{
Addressables.UnloadSceneAsync(loadHandle);
}
}
#endregion
}