Platform should be initialized in the Boot, before everything else. Got rid of the coroutines
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Nox.Input;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
@@ -14,9 +15,9 @@ namespace Nox.Platform {
|
||||
}
|
||||
|
||||
public PlatformSettings PlatformSettings => desktopPlatformSettings;
|
||||
public IEnumerator Initialize(object applicationData) {
|
||||
public async Task Initialize(object applicationData) {
|
||||
var handle = Addressables.LoadAssetAsync<DesktopPlatformSettings>(assetReference);
|
||||
yield return new WaitUntil(() => handle.IsDone);
|
||||
await handle.Task;
|
||||
desktopPlatformSettings = handle.Result;
|
||||
Debug.Log($"Device Platform {desktopPlatformSettings.devicePlatform} initialized");
|
||||
InitializeInput();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Nox.Input;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nox.Platform {
|
||||
|
||||
@@ -16,7 +17,7 @@ namespace Nox.Platform {
|
||||
/// </summary>
|
||||
public interface IPlatform {
|
||||
PlatformSettings PlatformSettings { get; }
|
||||
IEnumerator Initialize(object applicationData);
|
||||
Task Initialize(object applicationData);
|
||||
IInput InitializeInput();
|
||||
void Tick();
|
||||
void Dispose();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Nox.Input;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Nox.Platform {
|
||||
this.assetReference = assetReference;
|
||||
}
|
||||
public PlatformSettings PlatformSettings => editorPlatformSettings;
|
||||
public IEnumerator Initialize(object applicationData) {
|
||||
public async Task Initialize(object applicationData) {
|
||||
var handle = Addressables.LoadAssetAsync<UnityEditorPlatformSettings>(assetReference);
|
||||
yield return new WaitUntil(() => handle.IsDone);
|
||||
await handle.Task;
|
||||
editorPlatformSettings = handle.Result;
|
||||
Debug.Log($"Device Platform {editorPlatformSettings.devicePlatform} initialized");
|
||||
InitializeInput();
|
||||
|
||||
Reference in New Issue
Block a user