diff --git a/Explorer/Assets/Scenes/Main.unity b/Explorer/Assets/Scenes/Main.unity index 4481b061e8..7993ec4673 100644 --- a/Explorer/Assets/Scenes/Main.unity +++ b/Explorer/Assets/Scenes/Main.unity @@ -474,6 +474,7 @@ MonoBehaviour: useRemoteAssetsBundles: 1 isolateSceneCommunication: 0 portableExperiencesEnsToLoadAtGameStart: [] + decentralandEnvironment: 0 debugViewsCatalog: k__BackingField: {fileID: 9197481963319205126, guid: f3bf08b2b62097d4aa0574f7bafa4a86, type: 3} k__BackingField: {fileID: 9197481963319205126, guid: 6da3ff28c8a87e0428fa07019c15fa2f, type: 3} diff --git a/Explorer/Assets/Scripts/Global/Dynamic/BootstrapContainer.cs b/Explorer/Assets/Scripts/Global/Dynamic/BootstrapContainer.cs index 5546785a12..8fbde464c6 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/BootstrapContainer.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/BootstrapContainer.cs @@ -81,6 +81,7 @@ public static async UniTask CreateAsync( ICompressShaders compressShaders, IRealmUrls realmUrls, World world, + DecentralandEnvironment decentralandEnvironment, CancellationToken ct) { var browser = new UnityAppWebBrowser(decentralandUrlsSource); @@ -98,7 +99,7 @@ public static async UniTask CreateAsync( ApplicationParametersParser = applicationParametersParser, DebugSettings = debugSettings, WorldVolumeMacBus = new WorldVolumeMacBus(), - Environment = sceneLoaderSettings.DecentralandEnvironment + Environment = decentralandEnvironment }; await bootstrapContainer.InitializeContainerAsync(settingsContainer, ct, async container => diff --git a/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoaderSettings.cs b/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoaderSettings.cs index 23e2ef11cf..e5dddb71a5 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoaderSettings.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoaderSettings.cs @@ -9,20 +9,8 @@ namespace Global.Dynamic [CreateAssetMenu(fileName = "DynamicSceneLoaderSettings", menuName = "DCL/Various/Dynamic Scene LoaderSettings")] public class DynamicSceneLoaderSettings : ScriptableObject { - [field: SerializeField] public DecentralandEnvironment DecentralandEnvironment { get; private set; } [field: SerializeField] public List Realms { get; private set; } [field: SerializeField] public List Web3WhitelistMethods { get; private set; } - public void ApplyConfig(IAppArgs applicationParametersParser) - { - if (applicationParametersParser.TryGetValue(AppArgsFlags.ENVIRONMENT, out string? environment)) - ParseEnvironment(environment!); - } - - private void ParseEnvironment(string environment) - { - if (Enum.TryParse(environment, true, out DecentralandEnvironment env)) - DecentralandEnvironment = env; - } } } diff --git a/Explorer/Assets/Scripts/Global/Dynamic/MainSceneLoader.cs b/Explorer/Assets/Scripts/Global/Dynamic/MainSceneLoader.cs index 74144581cc..41cc753820 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/MainSceneLoader.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/MainSceneLoader.cs @@ -9,6 +9,7 @@ using DCL.DebugUtilities; using DCL.Diagnostics; using DCL.Input.Component; +using DCL.Multiplayer.Connections.DecentralandUrls; using DCL.Optimization.PerformanceBudgeting; using DCL.Platforms; using DCL.PluginSystem; @@ -18,7 +19,6 @@ using DCL.Utilities.Extensions; using DCL.Web3.Accounts.Factory; using DCL.Web3.Identities; -using DCL.WebRequests; using DCL.WebRequests.Analytics; using Global.AppArgs; using Global.Dynamic.RealmUrl; @@ -42,6 +42,9 @@ public class MainSceneLoader : MonoBehaviour, ICoroutineRunner [Header("Startup Config")] [SerializeField] private RealmLaunchSettings launchSettings = null!; + [Space] + [SerializeField] private DecentralandEnvironment decentralandEnvironment; + [Space] [SerializeField] private DebugViewsCatalog debugViewsCatalog = new (); @@ -100,6 +103,18 @@ private void OnDestroy() ReportHub.Log(ReportCategory.ENGINE, "OnDestroy successfully finished"); } + public void ApplyConfig(IAppArgs applicationParametersParser) + { + if (applicationParametersParser.TryGetValue(AppArgsFlags.ENVIRONMENT, out string? environment)) + ParseEnvironment(environment!); + } + + private void ParseEnvironment(string environment) + { + if (Enum.TryParse(environment, true, out DecentralandEnvironment env)) + decentralandEnvironment = env; + } + private async UniTask InitializeFlowAsync(CancellationToken ct) { IAppArgs applicationParametersParser = new ApplicationParametersParser( @@ -129,13 +144,13 @@ ITexturesFuse TextureFuseFactory() => ISystemMemoryCap memoryCap = new SystemMemoryCap(MemoryCapMode.MAX_SYSTEM_MEMORY); // we use max memory on the loading screen - settings.ApplyConfig(applicationParametersParser); + ApplyConfig(applicationParametersParser); launchSettings.ApplyConfig(applicationParametersParser); World world = World.Create(); var splashScreen = new SplashScreen(splashScreenAnimation, splashRoot, debugSettings.ShowSplash, splashScreenText); - var decentralandUrlsSource = new DecentralandUrlsSource(settings.DecentralandEnvironment, launchSettings.IsLocalSceneDevelopmentRealm); + var decentralandUrlsSource = new DecentralandUrlsSource(decentralandEnvironment, launchSettings.IsLocalSceneDevelopmentRealm); var texturesFuse = TextureFuseFactory(); @@ -161,6 +176,7 @@ ITexturesFuse TextureFuseFactory() => .WithLog("Load Guard"), realmUrls, world, + decentralandEnvironment, destroyCancellationToken );