Forum rules - please read before posting.

[Bug?] Music only starts to play in WebGL when clicked on the canvas

Not sure if I am seeing this right, but for some reason the Sound:Play Music action in the OnStart ActionList of my splash screen only starts to play in WebGL when clicked on the canvas. In the Unity editor and in a Windows build, it starts automatically as expected. Here is a excerpt from the actionlist:

Any ideas? The rest of the actionscript runs fine, but strangely, the music only actually starts to play when clicked. Why? :)

Comments

  • edited February 26

    What "canvas" are you referring to, and what are your AC/Unity version numbers?

    Is the game paused at this moment?

    I see that you're crossfading the music in your Action - is that because you're already playing something else? If so, is the last track still playing, or has it all stopped? If you're not playing anything else before, try setting the Method to Play instead.

    Let me know also if reducing the Transition time (s) to zero makes a difference.

  • Sorry, it still does not work. :( Tried resetting it to Play and Transition time to zero, yet it still only plays when clicked. See here: http://meltingpot.hu/10years/bug/. I am using Unity 2019.2.17f1, with AC 1.70.4

  • Ok, just found the solution or more like the root cause: it's a Chrome webgl thing:
    https://forum.unity.com/threads/chrome-on-the-dev-branch-version-66-may-block-audio-for-unity-webgl.517758/page-3
    It works in Edge. Strangely, Firefox gives a javascript error for some reason, no idea why...

  • The above unity forum post also describes a workaround by adding some javascript code to the index.html created by unity. It works.

  • Spoke too soon, does not work after all in Chrome. So I guess that is a browser limitation then...

  • Oh - by canvas you mean the web canvas - not a Unity UI Canvas?

    Yes, I'd agree this does sound like its down to the browser.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!