feat : add load scene sync method

pull/252/head
hevinci 2024-03-08 14:23:07 +08:00
parent 42104eb944
commit f4ddaedbf4
3 changed files with 24 additions and 0 deletions

View File

@ -64,6 +64,7 @@ namespace YooAsset
{ {
LoadSceneParameters parameters = new LoadSceneParameters(SceneMode); LoadSceneParameters parameters = new LoadSceneParameters(SceneMode);
SceneObject = SceneManager.LoadScene(MainAssetInfo.AssetPath, parameters); SceneObject = SceneManager.LoadScene(MainAssetInfo.AssetPath, parameters);
_steps = ESteps.Checking;
} }
else else
{ {

View File

@ -61,6 +61,7 @@ namespace YooAsset
{ {
LoadSceneParameters loadSceneParameters = new LoadSceneParameters(SceneMode); LoadSceneParameters loadSceneParameters = new LoadSceneParameters(SceneMode);
SceneObject = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode(MainAssetInfo.AssetPath, loadSceneParameters); SceneObject = UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode(MainAssetInfo.AssetPath, loadSceneParameters);
_steps = ESteps.Checking;
} }
else else
{ {

View File

@ -156,6 +156,28 @@ namespace YooAsset
#endregion #endregion
#region 场景加载 #region 场景加载
/// <summary>
/// 同步加载场景
/// </summary>
/// <param name="location">场景的定位地址</param>
/// <param name="sceneMode">场景加载模式</param>
public static SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single)
{
DebugCheckDefaultPackageValid();
return _defaultPackage.LoadSceneSync(location, sceneMode);
}
/// <summary>
/// 同步加载场景
/// </summary>
/// <param name="assetInfo">场景的资源信息</param>
/// <param name="sceneMode">场景加载模式</param>
public static SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single)
{
DebugCheckDefaultPackageValid();
return _defaultPackage.LoadSceneSync(assetInfo, sceneMode);
}
/// <summary> /// <summary>
/// 异步加载场景 /// 异步加载场景
/// </summary> /// </summary>