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: loading multiple pxs at start time issues #2847

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class ECSPortableExperiencesController : IPortableExperiencesController
private readonly IScenesCache scenesCache;
private readonly World globalWorld;
private readonly List<IPortableExperiencesController.SpawnResponse> spawnResponsesList = new ();
private readonly ServerAbout serverAbout = new ();
private readonly FeatureFlagsCache featureFlagsCache;
public Dictionary<ENS, Entity> PortableExperienceEntities { get; } = new ();

Expand Down Expand Up @@ -61,17 +60,20 @@ public ECSPortableExperiencesController(
}
}

if (PortableExperienceEntities.ContainsKey(ens)) throw new Exception($"ENS {ens} is already loaded");

string worldUrl = string.Empty;

if (ens.IsValid) { worldUrl = ens.ConvertEnsToWorldUrl(); }

if (!worldUrl.IsValidUrl()) throw new ArgumentException("Invalid Spawn params. Provide a valid ENS name");
if (!worldUrl.IsValidUrl()) throw new ArgumentException($"Invalid Spawn params. Provide a valid ENS name {ens}");

var portableExperiencePath = URLDomain.FromString(worldUrl);
URLAddress url = portableExperiencePath.Append(new URLPath("/about"));

GenericDownloadHandlerUtils.Adapter<GenericGetRequest, GenericGetArguments> genericGetRequest = webRequestController.GetAsync(new CommonArguments(url), ct, ReportCategory.REALM);

ServerAbout serverAbout = new ServerAbout();
ServerAbout result = await genericGetRequest.OverwriteFromJsonAsync(serverAbout, WRJsonParser.Unity);

if (result.configurations.scenesUrn.Count == 0)
Expand All @@ -90,9 +92,11 @@ public ECSPortableExperiencesController(
portableExperiencePath.Value
);


ISceneFacade parentScene = scenesCache.Scenes.FirstOrDefault(s => s.SceneStateProvider.IsCurrent);
string parentSceneName = parentScene != null ? parentScene.Info.Name : "main";
Entity portableExperienceEntity = globalWorld.Create(new PortableExperienceRealmComponent(realmData, parentSceneName, isGlobalPortableExperience), new PortableExperienceComponent(ens));

PortableExperienceEntities.Add(ens, portableExperienceEntity);

return new IPortableExperiencesController.SpawnResponse
Expand Down
Loading