0 votes

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:
enter image description here

and this is how it looks on HTML5:
enter image description here

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");
Godot version 3.5.1 mono
in Engine by (12 points)
edited by

1 Answer

0 votes

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.

by (1,079 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.