Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upgrade to unity 2023.2 #22

Merged
merged 7 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
@semantic-release/git
branch: main
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Post Release Checkout
id: post_release
uses: actions/checkout@v3
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
project-path:
- ./
testMode:
# TODO: Restore playmode tests once Unity fixes the linux editor tests issue: https://github.com/mygamedevtools/scene-loader/issues/18
# - playmode
- standalone
- playmode
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -31,7 +29,7 @@ jobs:
key: Library-${{ matrix.project-path }}
restore-keys: |
Library-
- uses: game-ci/unity-test-runner@v3
- uses: game-ci/unity-test-runner@v4
id: tests
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
Expand Down
12 changes: 6 additions & 6 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"dependencies": {
"com.cysharp.unitask": "2.3.3",
"com.cysharp.unitask": "2.5.0",
"com.mygamedevtools.script-template": "3.4.0",
"com.unity.addressables": "1.21.15",
"com.unity.feature.development": "1.0.1",
"com.unity.addressables": "1.21.19",
"com.unity.feature.development": "1.0.2",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.5",
"com.unity.ugui": "1.0.0",
"com.unity.timeline": "1.8.6",
"com.unity.ugui": "2.0.0",
"com.unity.modules.accessibility": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* ILoadSceneInfo.cs
* Created by: João Borks [[email protected]]
* Created on: 8/24/2022 (en-US)
*/

using UnityEngine.SceneManagement;

namespace MyGameDevTools.SceneLoading
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* ISceneLoader.cs
* Created by: João Borks [[email protected]]
* Created on: 7/16/2022 (en-US)
*/

using UnityEngine.SceneManagement;

namespace MyGameDevTools.SceneLoading
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* ISceneLoaderAsync.cs
* Created by: João Borks [[email protected]]
* Created on: 8/15/2022 (en-US)
*/

#if ENABLE_UNITASK
using Cysharp.Threading.Tasks;
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* ISceneManager.cs
* Created by: João Borks [[email protected]]
* Created on: 2022-12-21
*/

using System;
using System.Threading.Tasks;
using UnityEngine.SceneManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingBehavior.cs
* Created by: João Borks [[email protected]]
* Created on: 7/23/2022 (en-US)
*/

using UnityEngine;

namespace MyGameDevTools.SceneLoading
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingFader.cs
* Created by: João Borks [[email protected]]
* Created on: 7/23/2022 (en-US)
*/

using System.Collections;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingFeedbackSlider.cs
* Created by: João Borks [[email protected]]
* Created on: 7/23/2022 (en-US)
*/

using UnityEngine;
using UnityEngine.UI;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingFeedbackText.cs
* Created by: João Borks [[email protected]]
* Created on: 7/23/2022 (en-US)
*/

using UnityEngine;
using UnityEngine.UI;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if ENABLE_TMP
/**
* LoadingFeedbackTextMeshPro.cs
* Created by: João Borks [[email protected]]
* Created on: 7/25/2022 (en-US)
*/

using TMPro;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingProgress.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-01-31
*/

using System;

namespace MyGameDevTools.SceneLoading
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingState.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-01-31
*/

namespace MyGameDevTools.SceneLoading
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#if ENABLE_UNITASK && !OVERRIDE_DISABLE_UNITASK
#define USE_UNITASK
#endif
/**
* SceneManager.cs
* Created by: João Borks [[email protected]]
* Created on: 2022-12-21
*/

#if USE_UNITASK
using Cysharp.Threading.Tasks;
#endif
Expand Down Expand Up @@ -78,9 +72,9 @@
public async ValueTask<Scene[]> LoadScenesAsync(ILoadSceneInfo[] sceneInfos, int setIndexActive = -1, IProgress<float> progress = null)
{
if (sceneInfos == null || sceneInfos.Length == 0)
throw new ArgumentException(nameof(sceneInfos), $"[{GetType().Name}] Provided scene group is null or empty.");

Check warning on line 75 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L75

Added line #L75 was not covered by tests
if (setIndexActive >= sceneInfos.Length)
throw new ArgumentException(nameof(setIndexActive), $"[{GetType().Name}] Provided index to set active is bigger than the provided scene group size.");

Check warning on line 77 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L77

Added line #L77 was not covered by tests

var operationGroup = GetLoadSceneOperations(sceneInfos, ref setIndexActive);
if (operationGroup.Operations.Count == 0)
Expand Down Expand Up @@ -120,7 +114,7 @@
public async ValueTask<Scene[]> UnloadScenesAsync(ILoadSceneInfo[] sceneInfos)
{
if (sceneInfos == null || sceneInfos.Length == 0)
throw new ArgumentException($"[{GetType().Name}] Provided scene group is null or empty.", nameof(sceneInfos));

Check warning on line 117 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L117

Added line #L117 was not covered by tests

var loadedScenes = GetLastLoadedScenesByInfos(sceneInfos, out var unloadingIndexes);
if (loadedScenes.Count == 0)
Expand All @@ -130,10 +124,10 @@
var unloadingScenes = new Scene[unloadingLength];
int i;
for (i = 0; i < unloadingLength; i++)
unloadingScenes[i] = loadedScenes[unloadingIndexes[i]];

Check warning on line 127 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L127

Added line #L127 was not covered by tests

for (i = 0; i < unloadingLength; i++)
loadedScenes.Remove(unloadingScenes[i]);

Check warning on line 130 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L130

Added line #L130 was not covered by tests

var operationGroup = new AsyncOperationGroup(loadedScenes.Count);
foreach (var scene in loadedScenes)
Expand All @@ -160,12 +154,12 @@

var tasks = new Task[unloadingLength];
for (i = 0; i < unloadingLength; i++)
tasks[i] = WaitForSceneUnload(unloadingScenes[i]).AsTask();

Check warning on line 157 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L157

Added line #L157 was not covered by tests

await Task.WhenAll(tasks);

foreach (var scene in unloadingScenes)
loadedScenes.Add(scene);

Check warning on line 162 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L162

Added line #L162 was not covered by tests
return loadedScenes.ToArray();
}

Expand Down Expand Up @@ -198,7 +192,7 @@
if (TryGetLoadSceneOperation(sceneInfos[i], out var operation))
operationGroup.Operations.Add(operation);
else if (i == setIndexActive)
setIndexActive = -1;

Check warning on line 195 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L195

Added line #L195 was not covered by tests
}
return operationGroup;
}
Expand All @@ -217,7 +211,7 @@
sceneCount = _unloadingScenes.Count;
for (i = 0; i < sceneCount; i++)
if (tryValidateSceneReference(_unloadingScenes[i], out int index))
unloadingIndexesList.Add(index);

Check warning on line 214 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L214

Added line #L214 was not covered by tests

if (sceneInfosList.Count > 0)
{
Expand Down Expand Up @@ -262,16 +256,16 @@
}

if (sceneInfosList.Count > 0)
{
var builder = new StringBuilder($"[{GetType().Name}] Some of the scenes could not be found loaded in the Unity Scene Manager:\n");
for (int i = 0; i < sceneInfosList.Count; i++)
builder.AppendLine($" ({i}): {sceneInfosList[i]}");

Check warning on line 262 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L259-L262

Added lines #L259 - L262 were not covered by tests

Debug.LogWarning(builder.ToString());

Check warning on line 264 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L264

Added line #L264 was not covered by tests

if (setIndexActive >= 0 && sceneInfosList.Contains(sceneInfos[setIndexActive]))
setIndexActive = -1;
}

Check warning on line 268 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L266-L268

Added lines #L266 - L268 were not covered by tests

return scenes.ToArray();

Expand All @@ -298,10 +292,10 @@
operation = UnitySceneManager.LoadSceneAsync(index, LoadSceneMode.Additive);
else if (sceneInfo.Reference is string name)
operation = UnitySceneManager.LoadSceneAsync(name, LoadSceneMode.Additive);
else if (sceneInfo.Reference is Scene scene)
operation = UnitySceneManager.LoadSceneAsync(scene.buildIndex, LoadSceneMode.Additive);

Check warning on line 296 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L295-L296

Added lines #L295 - L296 were not covered by tests
else
Debug.LogWarning($"[{GetType().Name}] Unexpected {nameof(ILoadSceneInfo.Reference)} type.");

Check warning on line 298 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManager.cs#L298

Added line #L298 was not covered by tests

return operation != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
#if ENABLE_UNITASK && !OVERRIDE_DISABLE_UNITASK
#define USE_UNITASK
#endif
/**
* {nameof(SceneManagerAddressable)}.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-01-21
*/

#if USE_UNITASK
using Cysharp.Threading.Tasks;
#endif
Expand Down Expand Up @@ -80,9 +74,9 @@
public async ValueTask<Scene[]> LoadScenesAsync(ILoadSceneInfo[] sceneInfos, int setIndexActive = -1, IProgress<float> progress = null)
{
if (sceneInfos == null || sceneInfos.Length == 0)
throw new ArgumentException(nameof(sceneInfos), $"[{GetType().Name}] Provided scene group is null or empty.");

Check warning on line 77 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L77

Added line #L77 was not covered by tests
if (setIndexActive >= sceneInfos.Length)
throw new ArgumentException(nameof(setIndexActive), $"[{GetType().Name}] Provided index to set active is bigger than the provided scene group size.");

Check warning on line 79 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L79

Added line #L79 was not covered by tests

var operationGroup = GetLoadSceneOperations(sceneInfos, ref setIndexActive);
if (operationGroup.Operations.Count == 0)
Expand Down Expand Up @@ -122,7 +116,7 @@
public async ValueTask<Scene[]> UnloadScenesAsync(ILoadSceneInfo[] sceneInfos)
{
if (sceneInfos == null || sceneInfos.Length == 0)
throw new ArgumentException($"[{GetType().Name}] Provided scene group is null or empty.", nameof(sceneInfos));

Check warning on line 119 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L119

Added line #L119 was not covered by tests

var loadedScenes = GetLastLoadedScenesByInfos(sceneInfos, out var unloadingIndexes);
if (loadedScenes.Count == 0)
Expand All @@ -132,10 +126,10 @@
var unloadingScenes = new SceneInstance[unloadingLength];
int i;
for (i = 0; i < unloadingLength; i++)
unloadingScenes[i] = loadedScenes[unloadingIndexes[i]];

Check warning on line 129 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L129

Added line #L129 was not covered by tests

for (i = 0; i < unloadingLength; i++)
loadedScenes.Remove(unloadingScenes[i]);

Check warning on line 132 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L132

Added line #L132 was not covered by tests

var operationGroup = new AsyncOperationHandleGroup(loadedScenes.Count);
foreach (var sceneInstance in loadedScenes)
Expand All @@ -162,12 +156,12 @@

var tasks = new Task[unloadingLength];
for (i = 0; i < unloadingLength; i++)
tasks[i] = WaitForSceneUnload(unloadingScenes[i]).AsTask();

Check warning on line 159 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L159

Added line #L159 was not covered by tests

await Task.WhenAll(tasks);

foreach (var scene in unloadingScenes)
loadedScenes.Add(scene);

Check warning on line 164 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L164

Added line #L164 was not covered by tests

return ToSceneArray(loadedScenes);
}
Expand Down Expand Up @@ -202,7 +196,7 @@
if (TryGetLoadSceneOperation(sceneInfos[i], out var operation))
operationGroup.Operations.Add(operation);
else if (i == setIndexActive)
setIndexActive = -1;

Check warning on line 199 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L199

Added line #L199 was not covered by tests
}
return operationGroup;
}
Expand All @@ -220,8 +214,8 @@

sceneCount = _unloadingScenes.Count;
for (i = 0; i < sceneCount; i++)
if (tryValidateSceneReference(_unloadingScenes[i], out int index))
unloadingIndexesList.Add(index);

Check warning on line 218 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L217-L218

Added lines #L217 - L218 were not covered by tests

if (sceneInfosList.Count > 0)
{
Expand Down Expand Up @@ -280,7 +274,7 @@

bool isValid = operationHandle.IsValid();
if (!isValid)
Debug.LogWarning($"[{GetType().Name}] Unexpected {nameof(ILoadSceneInfo.Reference)} type: {sceneInfo.Reference}");

Check warning on line 277 in Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Managers/SceneManagerAddressable.cs#L277

Added line #L277 was not covered by tests
return isValid;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* SceneLoaderAsync.cs
* Created by: João Borks [[email protected]]
* Created on: 7/16/2022 (en-US)
*/

using System;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -68,7 +62,11 @@

var currentScene = externalOrigin ? externalOriginScene : _manager.GetActiveScene();

#if UNITY_2023_2_OR_NEWER
var loadingBehavior = Object.FindObjectsByType<LoadingBehavior>(UnityEngine.FindObjectsSortMode.None).FirstOrDefault(l => l.gameObject.scene == loadingScene);
#else
var loadingBehavior = Object.FindObjectsOfType<LoadingBehavior>().FirstOrDefault(l => l.gameObject.scene == loadingScene);
#endif
return loadingBehavior
? await TransitionWithIntermediateLoadingAsync(targetScenes, setIndexActive, intermediateSceneInfo, loadingBehavior, currentScene, externalOrigin)
: await TransitionWithIntermediateNoLoadingAsync(targetScenes, setIndexActive, intermediateSceneInfo, currentScene, externalOrigin);
Expand Down Expand Up @@ -119,7 +117,7 @@
}

public override string ToString()
{
return $"Scene Loader [Async] with {_manager.GetType().Name}";
}

Check warning on line 122 in Packages/mygamedevtools-scene-loader/Runtime/SceneLoaders/SceneLoaderAsync.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/SceneLoaders/SceneLoaderAsync.cs#L120-L122

Added lines #L120 - L122 were not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* SceneLoaderCoroutine.cs
* Created by: João Borks [[email protected]]
* Created on: 9/4/2022 (en-US)
*/

using System;
using System.Collections;
using System.Linq;
Expand Down Expand Up @@ -77,7 +71,11 @@

var currentScene = externalOrigin ? externalOriginScene : _manager.GetActiveScene();

#if UNITY_2023_2_OR_NEWER
var loadingBehavior = Object.FindObjectsByType<LoadingBehavior>(UnityEngine.FindObjectsSortMode.None).FirstOrDefault(l => l.gameObject.scene == loadingScene);
#else
var loadingBehavior = Object.FindObjectsOfType<LoadingBehavior>().FirstOrDefault(l => l.gameObject.scene == loadingScene);
#endif
yield return loadingBehavior
? TransitionWithIntermediateLoadingAsync(targetScenes, setIndexActive, intermediateSceneInfo, loadingBehavior, currentScene, externalOrigin)
: TransitionWithIntermediateNoLoadingAsync(targetScenes, setIndexActive, intermediateSceneInfo, currentScene, externalOrigin);
Expand Down Expand Up @@ -120,7 +118,7 @@
}

public override string ToString()
{
return $"Scene Loader [Coroutine] with {_manager.GetType().Name}";

Check warning on line 122 in Packages/mygamedevtools-scene-loader/Runtime/SceneLoaders/SceneLoaderCoroutine.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/SceneLoaders/SceneLoaderCoroutine.cs#L121-L122

Added lines #L121 - L122 were not covered by tests
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if ENABLE_UNITASK
/**
* SceneLoaderUniTask.cs
* Created by: João Borks [[email protected]]
* Created on: 8/1/2022 (en-US)
*/

using Cysharp.Threading.Tasks;
using System;
using System.Linq;
Expand Down Expand Up @@ -69,7 +63,11 @@

var currentScene = externalOrigin ? externalOriginScene : _manager.GetActiveScene();

#if UNITY_2023_2_OR_NEWER
var loadingBehavior = Object.FindObjectsByType<LoadingBehavior>(UnityEngine.FindObjectsSortMode.None).FirstOrDefault(l => l.gameObject.scene == loadingScene);
#else
var loadingBehavior = Object.FindObjectsOfType<LoadingBehavior>().FirstOrDefault(l => l.gameObject.scene == loadingScene);
#endif
return loadingBehavior
? await TransitionWithIntermediateLoadingAsync(targetScenes, setIndexActive, intermediateSceneInfo, loadingBehavior, currentScene, externalOrigin)
: await TransitionWithIntermediateNoLoadingAsync(targetScenes, setIndexActive, intermediateSceneInfo, currentScene, externalOrigin);
Expand Down Expand Up @@ -108,14 +106,18 @@
return;

if (externalOrigin)
#if UNITY_2023_2_OR_NEWER
await UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(currentScene).ToUniTask();
#else
await UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(currentScene);
#endif
else
await _manager.UnloadSceneAsync(new LoadSceneInfoScene(currentScene));
}

public override string ToString()
{
return $"Scene Loader [UniTask] with {_manager.GetType().Name}";
}

Check warning on line 121 in Packages/mygamedevtools-scene-loader/Runtime/SceneLoaders/SceneLoaderUniTask.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/SceneLoaders/SceneLoaderUniTask.cs#L119-L121

Added lines #L119 - L121 were not covered by tests
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if ENABLE_ADDRESSABLES
/**
* LoadSceneInfoAssetReference.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-02-01
*/

using System;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.ResourceProviders;
Expand Down Expand Up @@ -35,8 +29,8 @@
}

public override string ToString()
{
return $"Scene with asset reference {_assetReference}";
}

Check warning on line 34 in Packages/mygamedevtools-scene-loader/Runtime/Structs/LoadSceneInfoAssetReference.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Structs/LoadSceneInfoAssetReference.cs#L32-L34

Added lines #L32 - L34 were not covered by tests
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadSceneInfoIndex.cs
* Created by: João Borks [[email protected]]
* Created on: 8/24/2022 (en-US)
*/

using System;
using UnityEngine.SceneManagement;

Expand Down Expand Up @@ -33,7 +27,7 @@
public bool IsReferenceToScene(Scene scene) => scene.buildIndex == _buildIndex;

public override string ToString()
{
return $"Scene with index [{_buildIndex}]";
}

Check warning on line 32 in Packages/mygamedevtools-scene-loader/Runtime/Structs/LoadSceneInfoIndex.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Structs/LoadSceneInfoIndex.cs#L30-L32

Added lines #L30 - L32 were not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadSceneInfoName.cs
* Created by: João Borks [[email protected]]
* Created on: 8/24/2022 (en-US)
*/

using System;
using UnityEngine.SceneManagement;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadSceneInfoScene.cs
* Created by: João Borks [[email protected]]
* Created on: 2022-12-21
*/

using System;
using UnityEngine.SceneManagement;

Expand All @@ -25,7 +19,7 @@
public bool IsReferenceToScene(Scene scene) => scene == _scene;

public override string ToString()
{
return $"Scene \"{_scene.name}\" [{_scene.handle}]";
}

Check warning on line 24 in Packages/mygamedevtools-scene-loader/Runtime/Structs/LoadSceneInfoScene.cs

View check run for this annotation

Codecov / codecov/patch

Packages/mygamedevtools-scene-loader/Runtime/Structs/LoadSceneInfoScene.cs#L22-L24

Added lines #L22 - L24 were not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* RoutineBehaviour.cs
* Created by: João Borks [[email protected]]
* Created on: 9/4/2022 (en-US)
*/

using UnityEngine;

public class RoutineBehaviour : MonoBehaviour
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* WaitTask.cs
* Created by: João Borks [[email protected]]
* Created on: 2022-12-21
*/

using System.Collections;
using System.Threading.Tasks;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingBehaviorTests.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-01-31
*/

using NUnit.Framework;
using System.Collections;
using UnityEngine;
Expand All @@ -16,7 +10,11 @@ public class LoadingBehaviorTests
[OneTimeTearDown]
public void Teardown()
{
#if UNITY_2023_2_OR_NEWER
var behaviors = Object.FindObjectsByType<LoadingBehavior>(FindObjectsSortMode.None);
#else
var behaviors = Object.FindObjectsOfType<LoadingBehavior>();
#endif
foreach (var b in behaviors)
Object.DestroyImmediate(b.gameObject);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingFaderTests.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-02-01
*/

using NUnit.Framework;
using System.Collections;
using UnityEngine;
Expand All @@ -16,8 +10,13 @@ public class LoadingFaderTests
[OneTimeTearDown]
public void Teardown()
{
#if UNITY_2023_2_OR_NEWER
Object.DestroyImmediate(Object.FindAnyObjectByType<LoadingBehavior>().gameObject);
Object.DestroyImmediate(Object.FindAnyObjectByType<LoadingFader>().gameObject);
#else
Object.DestroyImmediate(Object.FindObjectOfType<LoadingBehavior>().gameObject);
Object.DestroyImmediate(Object.FindObjectOfType<LoadingFader>().gameObject);
#endif
}

[UnityTest]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingFeedbackTests.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-01-31
*/

using NUnit.Framework;
using System.Collections;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* LoadingProgressTests.cs
* Created by: João Borks [[email protected]]
* Created on: 2023-01-31
*/

using NUnit.Framework;

namespace MyGameDevTools.SceneLoading.Tests
Expand Down
Loading
Loading