Switching scenes works fine on Windows export, but not on HTML5

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By zymsbgt

I am coding a 2D platformer game following this tutorial: https://www.youtube.com/watch?v=6ziIyx60N6I

however instead of using GDScript I am using C# to code. I noticed that the portal scene switching works fine on the Windows build but not on HTML5. On Windows it takes me to the next scene but on HTML5 it just spawns the player but nothing else.

This is how it looks like on Windows:

and this is how it looks on HTML5:

The HTML5 build can be played here: https://mochis-musical-adventure.pages.dev/async-multiplayer-game

Edit: Here’s my Portal.cs code

using Godot;
using System;

public class Portal : Area2D
[Export] private PackedScene nextScene, testScene;
private AnimationPlayer animationPlayer;

public override void _Ready()
    animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
    testScene = ResourceLoader.Load<PackedScene>("res://GameScenes/Level1.tscn");

public override string _GetConfigurationWarning()
    if (nextScene == null)
        return "The next scene property can't be empty!";
        return "";

public void _on_body_entered(Area2D _area)
    // maybe change this in future to show a speech bubble prompt to enter the portal?

private async void teleport()
    await ToSignal(animationPlayer, "animation_finished");
:bust_in_silhouette: Reply From: juppi

Issue could be the async code. As far as I know, async/await doesn’t work correctly with Godot and HTML5.

Also loading Resources can cause Problems.