#🌐┃web

1 messages · Page 3 of 1

high patrol
astral wave
#

Open console with f12, and press okay and check what console error log states. Emscripten is included in Unity so you dont need to include it unless you removed it.

#

I would suggest have your build loaded from addressables, as then you can load only parts you need during gameplay, it also provides remote loading so you can load from network easily. For bigger files you could use S3 or any other storage place, as versions can be controlled with addressables. Then all you need to deploy your Index.html with some base build to any webservice. As mentioned itch.io is pretty popular.

#

Sadly WebGL is pain in the ass and not all features that look obvious works on it. If you have Threading, tasks, VFX or any kind of multithreading, you are out of luck. As those is not supported what so ever. So any of these can cause your game work in unpredictable way. Missing textures depends on what render pipeline you are using, there were some bugs with if shader have receive shadow feature it will not be showed, but it was fixed in newer unity versions. For webgl i strongly suggest using Unity 2022.2.3 or above

outer osprey
sinful talon
#

But I have now been told by a couple of sources that it is not actually possible to get a html5 application to read from a precompiled x86 dll file. Expecially if the application was made in Unity

#

The only option is to re-write the library in c# instead.

astral wave
#

What Unity version you are using? Different unity versions uses different version of Emscript. It is totally possible that your unity emnscripten does not support linking

astral wave
#

it seems linking is only available in static way, and not dynamic. Also you could try to update to unity 2022.2.3 or above, as I believe that from 2022.2.2 emscript version was updated in webgl, so it might have new features. Sorry I do not know too deep about it, just a suggestion.

sinful talon
astral wave
sinful talon
#

oh I see

#

I have checked the webgl checkbox and am now rebuilding

sinful talon
#

hangon it says "exclude platforms" on mine

#

oh maybe its because I am using Unity 2020.3.5f1

astral wave
#

well maybe then wasnt a main problem from the start. You sure those dll dont have any Threading code inside right?

astral wave
#

also this information might be valuable. sorry I really don't know too much about your project, so this where my knowledge about these problems ends.

sinful talon
sinful talon
#

because all I get is this?

astral wave
# sinful talon because all I get is this?

you have market AnyPlatform, so thats why you dont see options like mine. also it depends on DLL. but as you have any platform market it wont be a problem. The problem is elsewhere.

sinful talon
#

but I uncheck any platform it just checks the 3 boxes under exclude platform

#

The dll was compiled using visual studios visual c++ compiler

#

does unity expect it to be in a different binary?

astral wave
#

you load this DLL directly in your game, does it work on other platforms?

#

https://emscripten.org/docs/compiling/Dynamic-Linking.html
check if it possible to go with static linking. sorry I dont rly know too much on this exact topic, but from what I seen it might be connected. In your place would create new project and try running only this dll in msot basic way to confirm it is fault of it. then try newest unity version just in case.

sinful talon
sinful talon
#

Are you sure you can use dll files with html5 applications made in Unity?

astral wave
# sinful talon I didn't think lib files worked with c# in Unity
That is unfortunately the case, and always will be. C++ DLLs, or more precisely, DLLs containing native x86 compiled code, cannot be used with WebAssembly, since those are DLLs that have been already compiled to target the wrong platform.

In order to use such DLLs, Unity would need to reverse-engineer/decompile them from x86 back to source, and then recompile them over to WebAssembly. This kind of technology is not feasible. The proper way is to take the original C++ source and directly "cross-compile" that to WebAssembly.

https://forum.unity.com/threads/include-c-dll-in-webgl-build.371130/

https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

#

you are correct, dirrectly using DLL is impossible. sorry.

#

I got confused with plugins I used, as they works on webgl and comes from DLL, but after double checking I found they had seperate code for WebGL.

sinful talon
#

I have upgraded the project to unity 2022.2.6f1 and but I still don't see the options in the screenshot you posted.

sinful talon
astral wave
south cove
#

Good Day Devs,

I am working on multiplayer WebGL experience with "Agora Voice WebGL Community SDK" and "Ready Player Me".

After adding both the SDKs, I noticed there are two different WebGL templates.

I combined both the HTML and JS codes from Agora and Ready player me, But seems to be there are multiple bugs that are causing issues in the application while running on server.

I want to know if there is a procedure to combine both the template and make it work efficiently.

Thanks

astral wave
# south cove Good Day Devs, I am working on multiplayer WebGL experience with "Agora Voice ...

Well both of them uses custom HTML template. You will need to combine them both into one.
https://docs.unity3d.com/Manual/webgl-templates.html

In short now you should have folder WebGLTemplates in your project. in that folder you will find both templates of your SDK. Create new template folder in that folder and combine HTML code that exists there (not only copy replace files, but manually edit text). Make sure there is no duplicates and all nessarasy JS stuff is included.

#

If you have errors that happens only on server that is different story. There is high chance that plugins are incompatible, for example uses parameters that uses same names. The easiest method is to open console on the browser (f12) and read the console logs, investigate source and try find core error names. There is no automatic way, you will need to do that manually.;

south cove
sweet oriole
#

Best to host from a web hosting provider backed by a CDN. Not exactly sure what problem here is though.
@high patrol Poki is a web game portal, just like Armor Games, Y8, CrazyGames... You generally try to publish your game as an iframe pointing to your site and getting it on as many web game portals as possible.

chrome smelt
outer osprey
high patrol
#

But yeah Danny's got the bullet point, find a CDN to host it

high patrol
astral wave
astral wave
sweet oriole
exotic locust
#

Does anyone has already tryed to publish an Unity X Vuforia Experience with webGL ?

high patrol
#

I think I had a stroke reading that

exotic locust
#

Sorry not to be a pro and being discovering. I would be more than happy to learn why is so obvious, may be you could explain me 🙂

high patrol
#

Doesn't say webgl, so probably not

exotic locust
charred briar
astral wave
#
 ParticleSystemRenderer particleRenderer = emiter.GetComponent<ParticleSystemRenderer>();

            // Get the particle system's material
            Material particleMaterial = particleRenderer.material;
            Material clonedMaterial = new Material(particleMaterial);

            clonedMaterial.EnableKeyword("_EMISSION");
           
            // Set emission intensity and color
            clonedMaterial.SetColor("_EmissionColor", emotionsOptions.emissionColor * emotionsOptions.emissionStrenght);
            clonedMaterial.SetFloat("_EmissionIntensity", emotionsOptions.emissionStrenght);
            clonedMaterial.mainTexture = emotionsOptions.sprite.texture;
            particleRenderer.material = clonedMaterial;

Could anyone tell me what is wrong with this code when I want to enable emission for the material of particles. Several notices of mine:

  1. in Editor, the emission is visible and emission strength control brightness, however on inspector The Emission parameter is showed not enabled.
  2. Even if editor you can see emission, on webgl build the emission is off. (On particles materials which have emission enabled by default things emission works as intended.)

Any ideas?

astral wave
#

so it seems
material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.None; is needed to make change visible on editor inspector. building webgl to check if that solves problem there as well.
Update: webgl still does not make particles to use emission with this code.

astral wave
#

Update: If particles are set to have emission before build, it have correct emission. Conclusion: activating emission during runtime does not work on WebGL. Any suggestions?

random talon
#

Trying to upload my web game on itch but got this error, how can I fix it?

sweet oriole
random talon
#

Oh its a player setting

high patrol
#

You can also unzip brotli files with an open source app called PeaZip. Kind of annoying 7zip doesn't support it yet

lucid glade
#

Anyone know if there's a way to stop shortcuts like Ctrl+S and Ctrl+W working in the browser when playing a unity webGL build?

charred briar
#

I don't think that would be allowed (security wise). You can prevent the website itself (html & js) from receiving keystrokes, but not the browser afaik. Unless you do a custom chromium build, that would probably do it.

astral wave
# lucid glade Anyone know if there's a way to stop shortcuts like Ctrl+S and Ctrl+W working in...

https://docs.unity3d.com/ScriptReference/WebGLInput-captureAllKeyboardInput.html
have you tried this?
And add this as well to JavaScript side. Will it work? Maybe.

//Using jQuery.hotkeys:

$(document).bind('keydown', 'ctrl+s', function(e) {
    e.preventDefault();
    alert('Ctrl+S');
    return false;
});
//Only with jQuery:

$(document).bind('keydown', function(e) {
  if(e.ctrlKey && (e.which == 83)) {
    e.preventDefault();
    alert('Ctrl+S');
    return false;
  }
});

terse hawk
#

Hey, we want to suspend our WebGL app when the Browser/Tab goes in the background (in the player settings, Run in Background = false ) but also need to refresh the app data if more than 24 hours have elapsed since the last refresh when the app becomes active again.

Is WaitForSecondsRealtime a reliable way to trigger that refresh across mobile and desktop browsers?

That is, if the app is suspended and has a coroutine running that uses yield WaitForSecondsRealtime, does it calculate the actual elapsed time once the app resumes?

Thanks for your insights!

astral wave
barren pollen
#

Hi, any one try to make facebook instant game with Unity? does it have any problems? I try to build an samples project and it's size is huge compare to Cocos creator?

outer rampart
barren pollen
#

I have tried project tiny once. But it's hard to familiar with that data oriented =)) Well. Maybe Cocos is good choice. I tried it. pretty same to Unity and have oop way of code. I still want to stick with Unity, but can find a solution for build size.

sweet oriole
#

Project Tiny has been discontinued. More web focused engines might be a better choice for now.

barren pollen
#

Download and load is quite too long for an 40 mb zipped using Unity Webgl :>>

barren pollen
#

Can Addressable can save the day for this build size problem? =))

sweet oriole
#

Yea DOTS stuff in general is getting there, but the pure DOTS runtime and core engine placeholders Project Tiny provided are no longer developed.

barren pollen
#

Oh. got that 🫡

sweet oriole
barren pollen
#

Yeh, thanks for samples. I'll try it.

#

I got CORS error at my test project 🥲

#

So didn't know if that work or not. Use google cloud to store. and struggle at that point =))

terse hawk
# astral wave I would give up doing it on webgl. As if it is suspended stuff will just not wor...

Hey thanks, I did a day of trying different things with javascript to handle refresh timing, and javascript isn't any more reliable at handling this either - probably less reliable than Unity. Due to browser differences I came to the conclusion the best way to deal with this is in Unity.

I have a scheme working now but requires running a coroutine that checks elapsed time at regular intervals. Right now the coroutine checks every 60 seconds and runs a couple of lines of code to determine the elapsed time. It does not seem to be a big draw on resources/battery.

I was just wondering if that interval could be increased to 24 hours- it could if WaitForSecondsRealtime calculates correctly when an app becomes active again. But you don't know specifically about that question?

high patrol
#

can you save a timestamp for when the user leaves the foreground?

terse hawk
# high patrol can you save a timestamp for when the user leaves the foreground?

probably could but I don't think that is needed - we already save a DateTime.Now in a variable when the data refresh happens, and we can check the current time against that saved value when the app starts back up with a coroutine running at regular intervals.

I just wanted to know if If I set a WaitForSecondsRealTime for 24 hours is that actual system clock time or Unity clock time, because normally even if you set the time scale to 0, Unity runs underneath to track Real Time. When a WebGL app goes in the background that is not necessarily true (even if Run In Background were true)

odd stag
#

I published a little test game on itch.io - https://reverend-speed.itch.io/th pw: money - and all seems well, but I have set the project to run on mobiles (as you can, on itch.io) and it doesn't seem to be working.

I've done this successfully in the past with WebGL and it's a nice, fast way to test WebGL publishing and touch controls. However, in this instance the game loads in the mobile browser, then goes fullscreen and freezes. Can anybody suggest a way to get this up and running as intended (ie. not fullscreen and playable!)...?

spare onyx
lament ginkgo
#

Game is currently hosted on a live hosting site, and not a local environment. any ideas why i'm getting this error?

tight echo
#

Ork framework just put out a demo build for 2d turn based levels.

Im testing to see how straightforward it would be to deploy to WebGL on ItchIO.
Ive turned compression off in project settings so that it loads, however i get this error. Ive tested a variety of other approaches and settings but the problem remains.

Any solutions would be appreciated.

The following error comes up when trying to play on itch:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
RuntimeError: call_indirect to a null table entry (evaluating '(dynCall_jii=Module["dynCall_jii"]=Module["asm"]["Th"]).apply(null,arguments)')
<?>.wasm-function[77539]@[wasm code]
<?>.wasm-function[36390]@[wasm code]
wasm-stub@[native code]
@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:308627
invoke_jii@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:385268
<?>.wasm-function[36390]@[wasm code]
<?>.wasm-function[1680]@[wasm code]
<?>.wasm-function[60099]@[wasm code]
<?>.wasm-function[26892]@[wasm code]
<?>.wasm-function[58583]@[wasm code]
<?>.wasm-function[50331]@[wasm code]
<?>.wasm-function[10098]@[wasm code]
<?>.wasm-function[36738]@[wasm code]
wasm-stub@[native code]
invoke_iiii@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:376546
<?>.wasm-function[36738]@[wasm code]
<?>.wasm-function[1877]@[wasm code]
<?>.wasm-function[22451]@[wasm code]
<?>.wasm-function[787]@[wasm code]
<?>.wasm-function[42950]@[wasm code]
<?>.wasm-function[48121]@[wasm code]
<?>.wasm-function[42961]@[wasm code]
<?>.wasm-function[6324]@[wasm code]
<?>.wasm-function[20005]@[wasm code]
<?>.wasm-function[42965]@[wasm code]
<?>.wasm-function[12468]@[wasm code]
<?>.wasm-function[39999]@[wasm code]
<?>.wasm-function[22352]@[wasm code]
<?>.wasm-function[22352]@[wasm code]
<?>.wasm-function[18248]@[wasm code]
<?>.wasm-function[36729]@[wasm code]
wasm-stub@[native code]
browserIterationFunc@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:207207
callUserCallback@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:160405
runIter@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:161677
Browser_mainLoop_runner@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework

cunning shell
#

Anyone can help me, how can I implement voice chat in webgl?

signal dagger
#

Hey! Any idea how to fix these errors?

charred briar
random talon
#

I read that to let a website page sendMessage to my unity webgl build I need to toggle the "Exported for External Embedding" but I can't see this setting, did something changed?

sweet oriole
random talon
#

Ok thanks, maybe I read old information

nocturne heath
#

Where else can I upload my unity webgl game? I have had great success using IFrame to link all of these websites to 1 github page so I only have to upload to github and have all of the websites on the latest build.

tawny cargo
#

I'm trying to develop a game in the world of iGaming/gambling. I have done this in Unity. If you want to see the demo for reference sake here it is
https://galahadgaming.com/Games/Builds
Note: This demo only works in FULL HD 1920*1080

This demo is a WebGL file. It works fine on Computer and Tablet, but not on Mobile. Mobile would be my main customer.

My understanding is that in this industry most people build just one version of a game (no separate Android/Windows builds, and use WebGL/HTML5. But because of publishing/build issues many have moved away Unity to something like Cocos2D.

This is all new subject matter to me, and I was wondering if anyone had any insight on this process or has experience with Unity building universal builds that work on Mobile.

azure bear
#

how to build?

astral wave
# tawny cargo I'm trying to develop a game in the world of iGaming/gambling. I have done this ...

use unity 2022.2 and above if you want mobile "official support". Tho if you edit template even on order versions you can run on mobile.
Easiest way is to create javascript which check if browser is mobile or not, then pass that data to Unity webgl, and depending on it you change what you need. Like UI or Graphics settings.

My current project runs on WebGL, but well.... you need to do heavy optimisations for it. Like if your games uses more than 500 mb RAM, you are out of luck for pretty much all iPhones and older devices. So unless your game is optimized it will not work. Otherwise it works just fine.

My personal opinion.... Webgl is not for mobile. not yet at least. It works but... well it.... scrap it, FUK WEBGL in general 😄 Want performance use threeJS or playcanvas and enjoy easier development and faster builds, build everything with JS. Want same game on all platforms? use webgl and Unity then and only then. And why in first place you are using WebGL when you can use Application on phone... Less batery drain, better perfomance, way bigger chance users will come back.

barren pollen
#

relevant to mobile, what compression do you guys use to build for both web-desktop and web-mobile?

barren pollen
#

oh, I mean, texture compression :3

astral wave
#

I use DXT for webgl

barren pollen
#

I build both etc and dxt but they both not support when mobile. I use for facebook instant game :>> they work fine on desktop. but on mobile, when I use devtools, there are log that texture is not support :>>

astral wave
barren pollen
#

I use 2020.3.38?

astral wave
#

I use automatic, and on global setings check DTX

#

other options bepends on object I am using it on.

#

but this is not very performant 😭

#

but at least work on pc mac and mobile

barren pollen
#

at least :3 it works. Let me try it.

astral wave
barren pollen
#

yeah. ios doesnot support etc. astc doesnot support desktop =)) I only try on edge so dont know if astc work on other browsers :3

astral wave
#

Edge is pretty same and chrome. so will work on most. I tested this setup on Safari, Opera, Chrome and Edge.

barren pollen
#

Maybe I need to test more about that. Well =)) I start to think I should use Cocos Creator to develop facebook instant game instead of stick with webgl Unity :>>

#

But many things that Unity can but Cocos can't :>>

outer rampart
#

I'd say use ASTC. If it runs on mobile, then it most likely also works on desktop with uncompressed textures haha. It will still work, just use more memory on PC@barren pollen
Otherwise you have to make a build for desktop and another for mobile

barren pollen
outer rampart
#

It also should work on desktop, just with more memory usage

barren pollen
outer rampart
barren pollen
outer rampart
#

Ah yeah that's true

#

As it needs to decompress all textures

#

The only true fix is to use 2 builds according to Unity. Having ASTC is the best method for a single build according to then.
Maybe try a different ASTC preset?

barren pollen
outer rampart
#

Maybe a less compressed version loads faster? Not sure

unborn nest
#

Is there some kind of issue with Input.GetAxis on webgl?

keen urchin
barren pollen
barren pollen
unborn nest
inner shell
#

Hi! I'm trying to build a webgl project, but I have no clue how to add my something.db as browsers won't allow getting the file locally/I don't know how to build it with the game and then access it via code. Anyone got any ideas what I could do?

manic wyvern
#

how to copy a text into clipboard? Like I will have a button, if I press it a text will be copied to the clipboard

sweet oriole
void canopy
#

why does this happen when i make a build?

outer rampart
#

@void canopy

  1. Which unity version? Tried updating?
  2. Using compression? Does the host platform support that compression?
void canopy
#

and yea im using compression

#

im pretty sure itch supprts it

astral wave
# void canopy im using itch.io

if you are using brotli you out of luck, you need do something out of box in order to run that compression. Try disabling compression to test. Also this error says nothing, open console f12 of browser and see extended message with more information.

gritty totem
outer rampart
sweet oriole
void canopy
arctic rose
#

You have to look at the console to see the actual error messages. It's a runtime error so it's unlikely to be related to compression.

void canopy
#

this is what its giving me

#

its weird cus windows builds work fine

odd stag
void canopy
#

what the flippity flappity do i do here

astral wave
# void canopy
  1. if it works on windows it does not mean it will work on webgl. As it does not support a lot of things, from VFX to threading and tasks.
  2. If something like this happens, build project in development mode and change stack trace to full stack trace on player publishing settings. With this game will not crash and will show exactly where the error is comming from.
  3. make sure when you build new project with different compression to update your index.html and loader.js file to so the loading names is correct.
void canopy
void canopy
#

trying to build caused this issue

cunning vine
#

Why do my builds keep getting cut off on the bottom bar? I thought the Itchio upload size for webGL was 960x600?

cunning vine
#

Actually, I got that figured out. Looks like the webGL bar adds an extra 60px. So setting the Itchio size to 960x660 makes it perfect, instead of 900x600. I am guessing 900x600 is for minimum projects, with no WebGL border.

astral wave
# void canopy

are you using JSLIBS? Webgl build is pretty sensitive, so it will break if there is any errors in the code.

#

also makes usre your build path and project path wouldnt have any non english symbols

void canopy
cosmic thistle
#

JSON file not working on webgl build of my game

#

i think

#

there is no other thing that could go wrong, i tested the other stuff

arctic rose
#

Show the code that tries to load it

cosmic thistle
#

dont judge it, it works on other platforms idk if it works on other platforms, i forgot to build it, im stoopid

arctic rose
#

Yeah remember when I said that that won't work in a build?

cosmic thistle
arctic rose
#

and I gave a solution that does work in a build

cosmic thistle
#

oh, i see\

#

how do i make a field of type TextAsset though?

arctic rose
#
public TextAsset jsonFile;
#

then jsonFile.text is the content of the file you drag there

cosmic thistle
#

whoa, i misunderstood, i thought it was a completely different aproach. Im sorry for being a dumbass then

#

Thanks a lot

cosmic thistle
arctic rose
#
string jsonString = jsonFile.text;
exotic quest
#

help i have

cunning vine
#

Why is WebGL's default upload size 960x600? Shouldn't it be 960x540? Otherwise it isnt 16:9

warm halo
#

So ive built a game in unity, it works totally fine in the editor, and it also works totally fine if I build it for windows but if I build it for webgl it breaks

#

like the map doesnt generate in the correct place at all

keen urchin
cunning vine
#

Not that it matters much, was just curious

terse hawk
warm halo
#

its a 2d tower defence game, it bases the map off of the ScreenToWorldPos function, i wasnt getting any errors in the editor or in the browser console

astral wave
astral wave
warm halo
#

Im getting this error on the WebGL build in developer mode with full stack trace enabled, but I don't get any errors in unity and it works fine in the editor. is this something to do with exporting it to webGL?

weary shard
native iron
#

If anyone is interested in using Unity and WebXR -> I created a short YT Tutorial + Github Repo (sample + empty template) to quickly get you started with De-Panther WebXR Exporter and VRTK + Tilia 🙂 https://www.youtube.com/watch?v=e7hVROj9qm4

inner shell
calm tendon
#

Hi, are there specific settings to have for a webgl build so it renders properly on most browsers? I got these warnings so followed them but it renders like white, black and yellow low resolution pixel weirdness on safari and the lighting is incorrect on chrome (both support webgl 2.0). I'm adding screenshots of my player settings, how it looks in safari, chrome and what it is supposed to look like. Is it the webgl settings causing this?

(for context: I removed webgl 1 for this build which isnt shown in the settings screenshot)

astral wave
calm tendon
astral wave
calm tendon
astral wave
# calm tendon Oh no I havent, what do I change in the index html file?
 var buildUrl = "Build" + "_" + buildVersion;
    var loaderUrl = buildUrl + "/build.loader.js";
    var errorReported = false;
    var config = {
    dataUrl: buildUrl + "/build.data.br",
    frameworkUrl: buildUrl + "/build.framework.js.br",
    codeUrl: buildUrl + "/build.wasm.br",

this part, make sure that it does not have br or gzip and files names are correct.

calm tendon
#

the camera settings are from the third person starter assets so i didnt change them

astral wave
#

what do you mean high fidelity?

#

is it custom render pipeline of some asset you have?

calm tendon
# astral wave is it custom render pipeline of some asset you have?

This is what my camera has as options, its from this third person asset pack https://assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-196526

Get the Starter Assets - Third Person Character Controller package from Unity Technologies and speed up your game development process. Find this & other Essentials options on the Unity Asset Store.

astral wave
#

yea and what is your URP high fidelity profile says? if it is deffered I think you are out of luck.

#

oh nwm it seems deffered is also supported by webgl

calm tendon
astral wave
astral wave
# calm tendon I get these errors from safari

It seems that files I was talking about is not loaded correctly. Or is not found. I would suggest reupload your newly build. Then make sure you clear the Cache before trying to load.

calm tendon
astral wave
#

but it is only on safari and not other browsers?

#

as it seems it tries to load files from directory that does not exists. I guess the temporary link have changed.

calm tendon
#

its the same on chrome too, i deleted any old builds to clear anything out, is that the cause?

astral wave
#

something with unity deployed is incorrect? Send me link to private I will check if I get same error. so could be sure it is not cache

#

Also make sure the deployent is succesfull

devout moth
#

hello, I am looking for some help with building a webgl game. I am running into an issue with trying to load a txt file, I have been trying to get it to load from dropbox and/or google drive, but it doesnt seem to be working. the bigger problem is that I don't see a way to test a webgl app without building everytime, which can take a while. is there a way to preview a webgl build in the unity editor?

astral wave
raw olive
#

huh... I just switching to WebGL platform for the first time in my project and I got a bunch of compile errors for some of my packages. when I looked into it, the Define Symbols list had been wiped clean.

is that normal? I don't use WebGL much. does it maintain a separate list of define symbols to the standalone player?

#

oh yeah... when I check the diffs in version control the ProjectSettings asset has a different item for "scriptingDefineSymbols" for standalone and webgl.

faint compass
#

im trying to make a webgl build for a game i made for a school club that i need to be able to submit as a browser game but every time i make a build it give me the error attached via image and I have never used webgl so i have no clue what causes this

astral wave
astral wave
#

this way game wont crash and you will see error what couses it in your code.

#

as you test local build try starting it with Build And Run to check if error appears. as it might be just your local webserver setup is incorrect.

light vessel
#

Hi everyone, what is the solution for my webgl build to support multi threading? Is it impossible?

outer rampart
#

You need native c++ code afaik.
Check the webgl roadmap @light vessel

#

It's close to impossible for many games haha

light vessel
outer rampart
#

Ah fair enough. Good luck!

drifting hill
#

Is there any way to hide the javascript content of a webgl build in any browser developer tools?

faint compass
# astral wave it would be nice to see full errorhead. But when u have problems like this I sug...

i did that but it still gives me the erorrs but somtimes it gives me another error that says abort("both async and sync fetching of the wasm failed") at error at jsStackTrace(file:///D:/built_Projects/TestBuilds/Build/TestBuilds.framework.js:739:12) ... and it happens before it loads. i found this (https://forum.unity.com/threads/webgl-both-async-and-sync-fetching-of-the-wasm-failed-build-and-runs-works-fails-when-uploading.944400/were) it say the diffrent error is cause because of a compresson bug but doing what it says did not fix it

#

im using netcode if that effects anything

#

also testing with build and run doesn't always show one off those errors but sometimes dose and when it dosent it wont load even after waitng 30+ min

thorny matrix
#

Does anyone know if Unity's WebGL / PWA builds work on Mobile ??

outer osprey
#

Hi guys, so I've built my game for WebGL and it works for localhost but when I push it to my website the game doesn't load at all, any ideas?

astral wave
astral wave
#

did u do what I suggested tho?

#

so you tried disabling compression? and build and run? what net codee do u use?

astral wave
faint compass
astral wave
faint compass
astral wave
#

Could you try build and deploy totaly emty scene just to check that you aredeploying corectly?

astral wave
#

check CodeMonkey for multiplayer tutorial to understand stuff.

faint compass
#

ill try building a basic scene

outer osprey
#

do i need to host the build files on a website like digitalocean?

#

or is having the build files in my repo enough

astral wave
outer osprey
astral wave
#

depending on your hosting service

#

for example

outer osprey
#

i use vercel to host my website

faint compass
astral wave
#

have you tried building development build for main project?

faint compass
thorny matrix
astral wave
# thorny matrix Hey. Thanks. NEWEST as in **2022.2.9** ??

at least 2022.2 It works on older as well, but you will need to change template to not show warnings. Also 2022.2 and above have way more control over the build. But have in mind you will need to optimize your game a lot, as if you reach 500mb memory usage most a bit older phones (especially iPhones) will just crash.

thorny matrix
astral wave
thorny matrix
astral wave
#

tho I am suprised you were able to make such a small build. How did you achieved it tho? as even emty sceene with unity webgl is quite big.

thorny matrix
#

lmk what you think

astral wave
#

I am suprised that you did not used PlayCanvas or Three.js for website

thorny matrix
#

do you have a preference between those two that you mentioned?

#

I just like making cool sci-fi UI with 3D elements

astral wave
#

PlayCanvas have online world creator. ThreeJS have less convenient tools. I would say Three.js is superior to others in performance and what it can do. Expecially if you need super small project and high performance.

#

your website idea is really cool btw! and implemented really well. It feels like website but way more interactive and interesting. Really good job!

thorny matrix
#

Does 3js have a 3D editor? (I DESPISE using html and css to build UI)

astral wave
#

it does. did not played with it a lot, but it have similar logic with unity editor.

thorny matrix
#

i see. thanks

astral wave
thorny matrix
#

I also use DOTween for like EVERYTHING in the UI

#

and just hope i can tween stuff with the UIToolkit

astral wave
thorny matrix
astral wave
#

Emmmm, not rly. as mainly Uitoolkit is overlay and do not support world space. Offcourse you can just render 3D objects on texture with cameras and stuff, but it bit a strugle for now.

thorny matrix
#

ahh i see

#

thanks for the info. what kind of stuff are you working on?

astral wave
#

Metaverse bullshit 😄

thorny matrix
thorny matrix
astral wave
#

It is, feel free to check it out and critique, sent link into private.

outer osprey
outer osprey
faint compass
faint compass
faint compass
astral wave
#

how do you start your game?

#

also have you tried this?

#

Because CORS should not be effected if you start your game with Build And Run. If you start them differently maybe the it is problem.

faint compass
# astral wave also have you tried this?

I tried with decompression fallback on and off and the other setting to ignore but i still get the errors. Also when it loads trhough build and run i get the attached image but the other error image i get by clicking on the file to start (added image of what i dubble click)

astral wave
#

why do you assume it will work if you double click?

#

It not how webgl projects works. You need to have WebServer to test it.

#

and you need to put it on webserver. (local or not)

#

only then it will be able to load your game correctly. also web serer needs to be configed to support compression type you chose. for example in your image it is gzip. others are brotli and etc.

#

Build and run -> unity creates tempoary web server for you. so thats why error is different. and only this error matters. as this start is correct.

faint compass
astral wave
#

build with these options on it will give you more data about what error it is

#

On your Editor do you have ANY red errors?\

#

like any at all?

faint compass
astral wave
# faint compass No and those settings were already on in the build with the error image

you really dont like answering all questions that are there don't you 😄
So from errors it seems it apears after starting listening of ipadress and port (which is incorrect most likely anyways. as it should be localhost:port you using). So I would assume this is problem of NetCode for game objects. Are you using relay? are you using newest NetcodeFor game objects? are you using newest transport layer? did you follow WebGL setup guidelines for netcode for game objects?
You might want to check this for more precise data about it:
https://discord.gg/unity-multiplayer-network

daring geyser
#

hey, does anyone know any tutorials that would help with downloading a save file from a WebGL build, i know for security reasons you cant do it directly but with an API you should be able to

dreamy lodge
#

Anyone know why a sound crashes a webgl build when it loops? my game crashes right when the music should start again.

astral wave
astral wave
dreamy lodge
#

Oh i found the problem i made a script that would scale objects to the beat of the music and forgot i had it get 0.1 seconds before the actual music so when it reached the end it would crash

muted oriole
#

anybody know why these textures look fine in the editor but terrible when built for webgl?

torn pagoda
torn pagoda
#

Developer options in your browser, check the resources tab

muted oriole
#

and if it is downgrading my textures, how would i go about preventing it?

torn pagoda
#

What texturesize are your textures? or do you have a huge atlas texture?

muted oriole
#

it's this, 1024x1024

#

would this bring up issues?

torn pagoda
#

I could imagine webgl has some limitation in max texture sizes

#

What does your webgl setting say in your texture override ?

muted oriole
#

you mean like the override here?

vestal cloak
muted oriole
torn pagoda
#

I guess you have a quality setting that decreases your texture as vertx said to quarter or half or whatever it is

muted oriole
#

it's on full res

vestal cloak
#
  • something is defaulting to the very low setting
torn pagoda
#

On all quality levels?

vestal cloak
muted oriole
#

oh

#

waitr

#

wait you're right

#

i see now

torn pagoda
#

Either remove the levels or be sure to set them correctly, so low and highend devices get the right things to be shown

muted oriole
#

it was on half res

#

let me build and verify that was the issue

#

seems likely

lone loom
#

how do i build as a html? i believ i have to change something in th ebuild settings so i can publish to itch.io i dont have an index file

astral wave
cinder creek
#

Hey, have they improved the speed of the webgl building new builds?

astral wave
cinder creek
#

I tested it last 2 months ago and it took almost 20 minutes for a small project ugh...

#

Can you cloud build webgl projects and make them faster?

charred briar
#

You can do anything you set your mind to. Repeat builds are faster (less to compile) and yes you could use a TeamCity server and remote build and pack your web projects if you like.

astral wave
#

Cloud build from my experience is not faster, but more convenient. If you working machine is really weak, then it will be faster. But as @charred briar mentioned, first build is always the longest. secondary are faster. It depends on your project, on textures on render pipeline settings and etc.

For example if minimal changes were made, it can build in 2 minutes. But My builds normally goes for around 10-15 mins.

lone loom
#

why doent it show the whole thing?

#

it cuts off at the right

#

even if i increase the pixels on itch io

keen urchin
#

Set a resolution that matches in your game window for a proper reference, and set the anchors so that the canvas scales properly for all required display resolutions

charred briar
#

You also need to set a better screen resolution target in the build settings. Google the size that Itch uses. And preview / test the scale first by using that same resolution in your game view.

void canopy
#

why is it that when i make a web GL build and the cursor is meant to be fully transparent, the cursor shows up as black?

safe juniper
#

I'm not sure if this is the right place to ask this, but I am using Unity Gaming Services' cloud save to save data, and we plan to have our project be hosted on itch.io as a webgl. I followed https://docs.unity.com/authentication/en/manual/SettingupGoogleSignin and got to a point where it seems like google sign in is only possible on android apps as the googleplaygames stuff doesn't seem to exist when the project is set to webgl. Does anyone know if it's possible to use google login with UGS on webgl, or do I need to find another authentication method (or is there an easier way to do this with webgl?)

astral wave
spare onyx
#

Hey friends, I am looking to profile my webgl build on mobile browsers. Any clues on how to accomplish that?

astral wave
# spare onyx Hey friends, I am looking to profile my webgl build on mobile browsers. Any clue...

Cute 😄 Dreams will be dreams. I would give up on this idea. Just optimize on pc browser. for touch use dev tools to run pc browser as device (f12 + device icon on corner of debug tools). Otherwise you will need to setup to send profiling data not to local host but somewhere else. Then setup profiler to connect and load from there. And if you will try to do that on iPhone you will run to even more problems.

For android you can connect your pc to phone and pass at least console data to pc with chrome develop tools. That might even connect your device to editor profiler.

But my honest opinion, if you are making it work on webgl, you need to profile it to browser and it should work on any device regardless.

outer rampart
#

Visualizing the data on UI can help a lot tho

bitter burrow
agile ravine
#

I have a very simple game with a size of ~10MB. The game runs perfectly on Chrome, but when opened in MS Edge on some computers the game has massive fps drop and it runs on 10fps or less. Sometimes when clicking the game it runs normally for couple of seconds. Anybody else has experienced something like this?

outer rampart
#

@bitter burrow which unity version?

weary shard
opal remnant
#

My game on WebGL seems to have major Z-fighting flickering issues, but when I build and run on my computer it is fine. Is this something to do with browser settings?

#

I am also planning to make a 3D platformer with a rather large town with a decent amount of assets, lighting, and characters; I am not sure what the limit is for in browser gameplay? This is like a Bullet Hell also.

weary shard
olive moss
#

I'm having the issue that canvas elements don't show up in my webgl build, anyone run into this issue?

weary shard
olive moss
#

couldn't really find anything that works D:

#

I FIXED IT, thx anway

graceful wigeon
#

Hey everyone, do you guys know how to change this text in a WebGL build? Thanks!

#

I tried looking into the HTML but I found nothing...

#

It probably is js related, but I don't really know

sturdy quartz
#

Hi I learned unity 3d from "Multiplayer Virtual Reality (VR) Development With Unity
" course in udemy. I completed the course and now after building the apk file I am not able to use it in my android device. The app launched and shown made with unity then it crashed and exited. I have another doubt as well "Can we build this same project as WebGL project?" to host it in the website.

astral wave
# sturdy quartz Hi I learned unity 3d from "Multiplayer Virtual Reality (VR) Development With Un...

Well your description is quite shallow. About crashing on android device, you should ask it on different thread. But there are thousand and one reason for it: you have some errors in your project. (editor does not creash, but build that is in non developer mode will crash immediately on error.), your build settings for target device was not correct, there are quite a lot build settings on build settings. I would suggest first try building empty scene and try if it works, to check if you doing things correctly. Or you using features that are not available on android but available on pc.

About webgl. Technicly yes, you can build same project on WebGL platform and host it on website (have in mind website needs to be setuped correctly, or use Unity services for simple testing). In most cases it does work. But there are a lot of limitations on WebGL, likes no threading, no VFX and etc. Also game needs to be optimized heavily to run smoothly on webgl.

sturdy quartz
hidden finch
#

Hi guys, I am looking for some asset or solutions where I can push log from build. We have WebGL build so logging into file in pc is not what we need, so I am searching for third-side choice, where we can push log file. Have you any tips what we can use please? 🙂

outer rampart
hybrid haven
#

You can change "game" to something else e.g. "simulation" if you don't want to classify your piece as a game. To do that, give your came a custom noun in the itch game page settings

#

As I said, you can remove this button and load your game immediately but I would not recommend doing so. You might think that it's not a big deal but image someone opening your game-page from a shitty phone. It would automatically start the unity player and probably crash the browser.

graceful wigeon
hybrid haven
#

I am happy to've helped

ebon sierra
#

anyone have any idea why my game might be stuck like this when pressing play on the webgl build on itch.io?

sweet oriole
ebon sierra
#

found 1 thing online i will try in publishing settings and see if it does anything

sweet oriole
#

Note that the only build compression Itch.io supports is gzip.

ebon sierra
#

Ok thanks I will try that

odd basalt
#

anybody know how to make a custom webgl loading screen?

#

like when your build is loading in the browser

#

rather than:

#

or the minimal build

verbal pike
#

I'm getting this error when I try to build and I don't know what I am doing wrong. This project for class is due tomorrow and I really need to figure out how to fix this and my professor isn't responding

#

please ping me if you respond

charred briar
charred briar
#

The quick way to view the WebGL Player locally is to use Unity's Build And Run option (menu: File > Build And Run). Unity uses a local web server to host your build, and opens it from a localhost URL.

#

Otherwise you can disable decompression and upload it to itch.io

#

Or set it to whatever compression itch allows

verbal pike
charred briar
verbal pike
#

ooh okay lemme try that

charred briar
#

The error above though thinks you tried to open it locally not on itch.io

verbal pike
#

got it okay

#

@charred briar THANK YOU SO MUCH!!!

dawn dagger
#

Any ideas why I would be getting:


Unhandled Exception: System.Net.HttpListenerException: Access is denied
   at System.Net.HttpListener.AddAllPrefixes()
   at System.Net.HttpListener.Start()
   at Program.RunServer()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()```
Using the `\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools`
#

^ I have to run in admin

odd basalt
#

Anybody have any good resources for adding Web3 buttons to unity games (payment / connect)

cinder creek
#

Christ! My small webgl project took almost an hour to build! Unity isn't trying to reduce the build times huh??

weary shard
# cinder creek Christ! My small webgl project took almost an hour to build! Unity isn't trying ...

Building a project in Unity can take a different amount of time depending on the size of the project, the amount of resources, the plugins used, and other factors. Unity tries to optimize the build process, but in some cases the build time can be quite long.

If you want to speed up the build process, try the following suggestions:

Optimize your resources by removing unused files and reducing the size of textures and models

charred briar
#

Also subsequent builds should go significantly faster. Adding compression etc takes longer. Compiling to assembly takes even longer still. And having a decent computer helps just from all the damn shader compiling 🙂

cinder creek
#

I use to be able to build the thing in 10 minutes (and I was complaining then) and now its 50 minutes with newer versions of Unity...going backwards! 😬

modest minnow
#

hi i have some problems

#

i dont have the webgl module and cant install modules for my unity version

frank lynx
#

You need to install Unity via Unity Hub to access the module options easily

modest minnow
#

yes but even in unity hub i cant install it

frank lynx
#

Did you install Unity through Unity Hub?

modest minnow
#

yup

frank lynx
#

Show your module page for the installation?

modest minnow
charred briar
#

Give as much information on what is happening as you can. It's not fun guessing what you are seeing.

modest minnow
#

it only propose me show in explorer

#

and remove from hub

#

and people have the add moduls but not me and i dont know why

frank lynx
#

That's the case for both of your versions? Because you have modules installed in your second one.

modest minnow
#

oh sorry i forgot , its only the case on the first one and thats the one that i use

frank lynx
#

Right, because as above, it wasn't installed via Hub. Note the file path differences between the two.

#

Just remove and reinstall it, save the headache of trying to fix it manually.

modest minnow
#

ok

#

thx

frank lynx
modest minnow
#

so i just re install it from the hub

#

?

frank lynx
#

Yes

modest minnow
#

ok thx

orchid bridge
#

Anyone know of a way to export a VR game as webgl?

outer rampart
marble meadow
#

hi, when I import models from Sketchup, my character can walk right through them, meaning they are not solid objects, how to fix?

marble meadow
astral wave
# outer rampart Did you add mesh colliders?

If you working on webgl, I suggest use generic colliders (like box or capsule) as much as possible instead of mesh colliders. As you want to save performance as much as you can.

outer rampart
#

Depends what the goal is. Getting primitive colliders on a complex shetchup model can take hours. If he just wants to run 1 model with collision for the player it's not that bad usually

subtle imp
#

Anyone ever managed to get something like pinch to zoom working on WebGL? I can get it working on an Android build no problem but when building for WebGL the touches seem to be registered weirdly/differently from when testing with an Android build. I'm using the old input API, if I use the new input API no touches get registered at all. Unity version is 2022.1.23f1.
Is there a known difference between how touches are processed on WebGL builds?

astral wave
# subtle imp Anyone ever managed to get something like pinch to zoom working on WebGL? I can ...
Unity WebGL doesn’t officially support mobile devices (see WebGL browser compatibility) but it does implement Input.touches and other related APIs in browsers and devices with touch support. By default, mobile devices display a soft keyboard on the touch screen for entering text into UI
 input fields. To disable this behavior, use the WebGLInput.mobileKeyboardSupport property.

Well there is no super approach. Also depends if you using new input system or old (at his point I would give up at old one.). With new imput sytem you can setup touch with more control and you can debug it as well more easily to see what exactly is triggered.

Sorry for not helping more, as in my case it works fine, but I don't use pinch or other multiple touch elements. So cannot confirm or deny anything. But at least new input system lets you config your own multitouch.

I guess main problem is the on webgl your touch is registered by browser and by game. So browser seeing pinch action, will try to zoom in, which might put webgl window out of focus. where you will get weird behaviors (either lose action or action will get stuck as it was never released). So you will need to design you website in a way so it either block browser logic or.... you will need to create javascript which can easily capture gestures on browsers and just pass that data to unity webgl.

hidden finch
#

Hey guys, is there way how to change WebGL build template via build command? I am building WebGL game always after changes are pushed on git. But I need to change template to minimal and I cant find build options for this one

weary shard
# hidden finch Hey guys, is there way how to change WebGL build template via build command? I a...

change the WebGL build template via the build command in Unity. Here's how you can do it:

  1. Open the Unity Editor and go to "File" > "Build Settings".
  2. Select "WebGL" as the target platform and click on the "Player Settings" button.
  3. In the Player Settings window, go to the "WebGL" tab and find the "Template" dropdown menu.
  4. Select the "Minimal" template from the dropdown menu.
  5. Close the Player Settings window and return to the Build Settings window.
  6. Click on the "Build" button to start the build process.

To automate this process, you can create a script that modifies the Player Settings and initiates the build process. You can then run this script whenever changes are pushed to your Git repository.VintageUnity3d

steady oxide
#

Anyone has luck having the game works in firefox ? mine works fine in edge. I let Unity open the game, the url is from localhost, and i get NS_ERROR_INVALID_CONTENT_ENCODING error in the network tab

charred briar
wooden rivet
#

i followed a unity learn tutorial on how to add webgl module and started to build it and it says no web gll module loaded so it says install with unity hub so i click on it and i do have it installed so i dont get what to do

hidden finch
turbid falcon
wooden rivet
#

ill try

hidden finch
sweet oriole
indigo crest
#

is it possible to use OpenUrl and for it to open on the same window? Without opening a new one?

brazen prairie
#

Hey guys, i need to configure CICD with Unity 2021.3.12f1

Anyone managed to do this?

alpine zenith
#

when putting my game on itch the canvas size is way off

#

its fine in the editor idk why this is happening

keen urchin
alpine zenith
#

These are my settings, they look right to me but clearly smts wrong

keen urchin
#

Specifically those that would be used on the web player

#

But the more resolutions and aspect ratios your UI supports, the better

alpine zenith
keen urchin
alpine zenith
tranquil tree
#

hello team, quick image sizing question

#

my high res jpeg is 8000x6400px and 13.3 mb on my desktop

#

when I bring it into unity and convert it to a sprite and webGL overide the max size to "8192" the file becomes 195.5 mb

#

thank you for any help on this

keen urchin
#

The size in build would be smaller after compression, however your texture is NPOT so it might not be possible to compress it

tranquil tree
keen urchin
#

The Max Size is not limiting its dimensions as it's not over the 8192 limit

#

always try to use POT dimensions for your graphics

tranquil tree
#

awesome thank you! 🙂

clever quiver
#

Hi! I am writing a game, that does work in test mode, but doesn't in built webgl. The feature in question is System.Net.Http Is there a way for me to know if the library works on webgl or not?

formal reef
#

Hi I am writing a game that does work in

smoky path
#

Hi all! I'm trying to build a game to WebGL and having trouble with it exporting all the assets. When I build it I get a blank project. I've tried searching online and some of the solutions I've found, but no luck getting any of them to work. I'm super new to Unity, so I might just be missing something obvious. If anyone is up for chatting about it feel free to DM me and I can send code screenshots and such 🙂 Would super appreciate any guidance.

outer rampart
smoky path
outer rampart
#

Make a debug build to see the logs?

smoky path
smoky path
outer rampart
#
  1. It shows a firefox workaround, did you try another browser?
  2. Updated unity already?
  3. It's your project, debug the errors (;
astral wave
stuck breach
#

I'm having an issue with create WebGL builds where it displays a solid color (it's the same color as the bottom left pixel of them screen I think). The issue goes away when I enter into fullscreen mode and does not persist even if I exit fullscreen mode. Any ideas on how I can fix it?

astral wave
jade valve
#

Good afternoon. Anyone know why on a webGL build, only non-english speakers have issues with the build? Here is one of the latest errors someone sent me.

jade valve
#

so, apparently, it is language settings in the browser that cause issues. If user switches language to 'english' issues go away. that seems odd.

outer rampart
#

Is unity updated?
Do you use any strings/paths to load data? @jade valve

jade valve
outer rampart
#

If it's just method names it should be fine.
I suggest to update unity and make a debug build and change your browser language to the one causing issues

stuck breach
teal garnet
#

I got this error when I switched to webgl and it disabled my post processing ArgumentException: Kernel 'MultiScaleVODownsample1' not found. This is the most important part of the error cause else the error would block the whole screen/

astral wave
#

Universal fix for these kind of problems. Exit project. Delete Library folder content. Start project again and let it rebuild library again. see if the error continues

teal garnet
#

found error it was something to do with the ambient occlusion one

desert nexus
#

Hey everyone,
I was wondering if it is possible to pass a memory address from a dll, and use this to create an array in Unity to have "sharedMemory", and avoid copying.
Otherwise there is going to be a lot of copying which is not ideal. Or any other known sollutions for this issue?

Thanks very much in advance

astral wave
wicked jewel
#

hello everybody, i try to use a websocket in unity (client) my server is node js. it's working in editor but not in my browser (in build)
i try with System.Net.WebSockets; and WebSocketSharp

azure atlas
#

Hey folks I'm having a problem with a WebGL build. whenever I play in editor I can see everything, but when I build to webGL everything disappears. does anyone know how to solve this???

astral wave
astral wave
#

I had problems with forward + on webgl before, change just to forward and check if it okay

#

I assume that you cant see anything is you see only sky box or something. As you might not spawn character with camera on Webgl as well. but My first guess is forward+.

azure atlas
#

checking that now

#

same problem

astral wave
#

could you show what you see when you "Build and Run" and then press f12 and check what console says

azure atlas
#

sure

azure atlas
astral wave
#

Wait... you were talking not about Runtime?

azure atlas
#

?

#

webGL build

astral wave
#

yea, can you send screenshot of browser and browser logs?

azure atlas
#

sure

astral wave
#

I was talking about f12 pressing on browser and seeing what it says. is it shader errors is it load errors or what.

azure atlas
#

sorry sorting out another error right now

#

give me a moment

astral wave
#

https://docs.unity3d.com/Manual/class-TextureImporterOverride.html#supported-formats
Will reconstruct question as got some data from testing. When you build for webgl you can choose one of 3 compressions, or you can choose compression for each texture in editor. The problem is that default compression is DXT, which is used of macOS, windows and etc. How ever if WebGL is loaded on iOS mobile for example, the DXT compression is not supported and it heavily increases memory usage.

So regarding this situation what should be correct approach to handle iOS devices.

  • For downloaded textures I can try compressing them via code, but textures that are in build is bit more complicated.
  • I could try create script and put it on every object in game, which have two textures references depending on device which one to use. But that would mean I need 2x amount of textures, which will increase build size and download size. Which once again... not nice.
  • I could try create different set of addressables assets that would be loaded depending on the device. This saves download size problem, but becomes very ugly to manage. And increasing list of addressables comes with memory overhead as well, which is not wanted.
  • I could try to have another project just copy but with different compression default option and just redirect to different webpage or load different webgl with JS depending on device. But once again. Extremely not fun.

Does anyone knows how to handle this hell? or have any more suggestions?

azure atlas
#

From what I know, I would duplicate the project when I needed to build, then change DXT from there

azure atlas
#

turns out I'm falling through the floor

daring lake
#

It is weird error, as it is better not to have Read/write enabled if you dont need it. as it takes extra memory and stuff. You dont use mesh colider or just normal colliders? but that should work same way on editor.

brittle inlet
#

guys i have a query

#

now i have lost the project files and want to edit the game

#

is there any way to download the game or something from play.unity.com?

arctic rose
#

You uploaded a compiled game. It can't be turned into a project anymore.

brittle inlet
#

damn

#

i have the project files but everything is pink be it on urp or hrp

#

ty for the help tho

astral wave
brittle inlet
#

yes i need some help with that

#

i set a backup and tried converting it to urp but it's still pink

astral wave
#

How did you converted? did you updated URP package as well? What your materials type is right now?

charred briar
#

You also don't need to update to URP, and could keep it in the standard built in pipeline. But make sure you start backing up your project and using version control if possible

orchid bridge
#

Can someone help solve this bug?i cant build my game with webgl build.this what i got when i try to build my game

astral wave
orchid bridge
astral wave
#

in build error just before status failed there should be tons of lines that says; oh error was there and here and blabla bla. or just post all logs using paste website or something.

astral wave
#

Anyone figured out how to compress to ASTC instead of DXT during runtime on webgl?

azure atlas
#

Question for people who have experience with Nginx:
Question about nginx with precompressed files (BR):
I have a preconfigured Nginx instance in a docker container.
This container has 2 volumes binded to a file location for served files and another for the Nginx configuration files.
in the Nginx configuration i have set the following:

    gzip off;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_proxied any;
    gzip_comp_level 5;
    gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application>                gzip_vary on;

When I try to use the Precompressed files for a Unity webGL game I get the following error:
Unable to parse Build/New folder.framework.js.br! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: br" present. Check browser Console and Devtools Network tab to debug.
What is the best way to go about configuring the nginx configuration to correctly serve the files?

wicked jewel
#

hello i have a question, who uses node js? for call this aplication in webgl

high patrol
#

doesn't webgl use node js? Uses SimpleWebServer.exe. Not sure if that is built on top of something else or what. It lives in "C:\Program Files\Unity\Hub\Editor%UnityVersion%\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\SimpleWebServer.exe"

desert nexus
#

Is it possible to use SharedArrayBuffers with Unity?
So have an array in WebAssembly, and let it be shared with an array in Unity?

Thanks in advance guys

civic sphinx
#

Hey guys, any suggestion to make a good configuration in unity to export to HTML for a 3D mobile web app?

astral wave
wintry flume
civic sphinx
#

mmm yeah, but I dont know all the things to make it low. I gonna take it ASTC then.

#

anyway ty for your a,dvices @wintry flume @astral wave

charred briar
wicked jewel
#

Sorry, I'm French and I asked my question badly. in fact I created a node js server and I was trying to call two unity applications (webgl) in directories and it always opened the same one for me as if there was a cache problem. and I solved the problem.

sullen plume
#

Hey Guys, how can I ask webgl doubts

frank lynx
#

With words typed from your keyboard

astral wave
rugged olive
#

guys im having a error when i try to export the project to webgl it gives me this error

#

BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <9959c9185b684a4d9d56448296fb9048>:0)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:179)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <9959c9185b684a4d9d56448296fb9048>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <9959c9185b684a4d9d56448296fb9048>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

#

and

#

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <9959c9185b684a4d9d56448296fb9048>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <9959c9185b684a4d9d56448296fb9048>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

#

longest one

unborn cedar
#

I've been having an Issue getting my WebGL build to work

#

Everytime i try to publish it on unity play i keep seeing a blank screen

#

and an error

#

in my console

#

I tried installing a custom package thats supposed to trace where the memory leaks come from but it been no dice

#

considering the fact that the error is only coming from me building and publishing

#

i dont think its a code issue

desert nexus
#

Hey guys,
I have a quick question regarding Unity and shared memory with the web.

I am able to make a shared array between Unity and the web by creating an array and initializing an array at that location in Javascript.
However, i am not able to do it the other way arround, so have an array in javascript and share that with the Unity side. I tried passing the pointer to the array and initializing a NativeArray in Unity but no luck so far.

Any thoughts on this issue? or known sollutions?
Thanks in advance guys!

unborn cedar
#

but my unity build

#

still isnt loading in

high patrol
pastel sedge
astral wave
#

Hello. I create simple webrequest in unity. Created error handling and etc there. But it request fails, browser prints the error, which I don't really like happening on production. I know that you can set to ignore specific errors on Unity, but is there better approach on handling errors on webgl?

astral wave
#

worth to say, that webrequest is called in try catch, and should not return any errors

hybrid sigil
#

i uploaded my project to itch.io and this error pops up when you play

#

how can i fix?

#

Ok i fixed it by changing the compression from brotli to gzip

jade valve
#

I have this webGL game, that I recently converted from Photon PUN (using playmaker visual scripting), to Photon FUSION (and got rid of playmaker). Plays great in Editor, but on build, frame rate is really low. My guess is single digits. And my ping to the server is over 2000 sometimes (when in editor was around 150ms). I'm not sure what this 'commit' is in the browser console

keen urchin
coarse zephyr
#

Hey guys, i'm new to this and I'm trying to get my unity project to be deployed on my website. I was wondering if anyone had any recommendations on how to do so.

#

I am currently attempting to use netlify

#

but it doesnt seem to be going well, when I try to upload the build folder to netlify it seems to just be uploading forever.

#

the file size of my build is 281MB, this shouldn't be an issue right?

sweet oriole
#

@coarse zephyr The netlify web uploading UI can be quite finicky and just retrying the upload can solve it. For a larger build I would consider checking out their CLI options to perhaps get more stability and feedback.

coarse zephyr
sweet oriole
# coarse zephyr Thanks! I will give that a shot and see if it works. In general, what is conside...

It doesn't really matter how much you have on the web server (within reason, netlify might want to know 😄 ), but generally it's more about how much the user needs to download to experience your content. I would generally want the initial download size (to see the main screen and what not) to be under 30MB and then load additional content either through Addressables or other means.
Minimum initial download sizes for references https://github.com/JohannesDeml/UnityWebGL-LoadingTest

#

If you need to download 280MB of content just to boot the game, some of your users would potentially have to wait for minutes just to see the main screen.

coarse zephyr
#

i have been waiting for a while and it does not seem to be loading

sweet oriole
#

Always check browser console. You most likely need to configure Netlify to serve content in the correct format

#

There are netlify unity templates out there if you look it up

coarse zephyr
sweet oriole
dark comet
#

I'm trying to build a game to WebGL and I have no compile errors in Unity, but JavaScript throws an error, but I have no idea where to even look

#

it's here but I don't know how to fix it

#

the website I'm loading it to says to set it to uncompressed

#

i try to look in the script and none of it means anything to me

astral wave
dark comet
dark comet
dark comet
#

building now

astral wave
#

have in mind it will take longer to build this way. also if you have compression on, have in mind it will build without compression and you might need to update your index.html if you have custom one. but most likely it will just work 🙂

dark comet
#

I have it set to no compression

#

are you saying to build it this way to find the error or to publish? The editor said not to publish this

astral wave
#

I suggest just use "build and run" so it will be hosted localy to see everything.

#

If you have specific code that needed API and cannot be local, you have no option but to publish it this way. test it. then delete it and deploy fixed version.

dark comet
#

it doesn't do this when I play it in the editor

#

and health is updating

#

I have a script that updates all of my ui with the player's stats

#

that's the only error that's coming up

#

trying to see if I can fix it

astral wave
# dark comet trying to see if I can fix it

This sometimes happens when you have references in your scripts of other game objects. Webgl order of actions might be not the same as editor. For example if you trying to update something in UpdateHealth, but that object is not actually spawned yet.

As you see it start at Overseer.Start(), and then tries access other objects, which also have start, there is a chance that their start is still not done, yet Overseer tries to access them. It is most likely in your UpdateHealth script. Try making sure if things are not null, or create logic that actually handles order of scripts manually

#

In short: if you reference different objects in start, make sure their start is already finished. You can create Innitialisation method to make sure it runs only after it is requested.

dark comet
#

So for UpdateLevels to run, the Canvas and its children have to already be created

astral wave
#

who creates them? i assume it is not in scene by default?

dark comet
#

Overseer and Canvas is in scene hierarchy

#

Overseer calls UpdateUI, which is a function in UpdateLevels script, UpdateHealth is a function in UpdateUI function

astral wave
#

sorry without seeing code I can't help more.

dark comet
#

if there's a better way to update UI please let me know, I'm sure I'm not doing it the best way (Particularly since there's errors)

#

what I don't understand is how I'm getting a null reference when the Canvas is what has UpdateLevels on it. Canvas has the objects as children that the UpdateLevels script is saying is a null reference

dark comet
#

I took the easy way out and put the error causing code in a (if component is not null) statement

#

but if there's a better way to do it please let me know

halcyon hedge
#

Only in WEBGL , anyone know what might cause this ?
Random Flickering light looking into one direction, I don't even have any of those in the scene...
the export settings were kept same quality as Editor.
Not sure why WebGL always messed up with bugs..

#

Issue happens in Editor too but when in WebGL mode..

halcyon hedge
#

narrowed the issue when switching to Gamma color space, apparently webgl doesn't build without it.
Is there no way to get around this?

random talon
#

How can I get the .unityweb format on build files?

sweet oriole
# random talon How can I get the .unityweb format on build files?

If you enable a Compression Method for your build, Unity identifies the extension that corresponds with the compression method and adds this extension to the names of the files inside the Build sub folder. If you enable Decompression Fallback, Unity appends the extension .unityweb to the build file names. Otherwise, Unity appends the extension .gz for the Gzip compression method, or .br for the Brotli compression method.
https://docs.unity3d.com/Manual/webgl-building.html

sweet oriole
halcyon hedge
reef vector
#

Hey Guys, I have an empty scene webgl and its bascially like 7mb is there a way i can bring down the size

#

already using brotli compression

reef vector
#

Thanks alot

lone matrix
#

Hi there! In the editor i can see all of my objects. Exporting to WebGL makes them disappear. How can i fix that? Am i missing something?

lone matrix
lone matrix
wraith leaf
#

Hello! I'm working on a WebGL project with Unity.Everything works fine in the Unity editor, but after building to WebGL I get an ERROR when calling the API. do you have any ideas?

high patrol
sweet oriole
tired valley
#

been having an issue when trying to download webgl modules, when i go to installation and assign it a folder it says "failed to locate unity.exe"

#

when i go to unity hub and click "Add modules" under my projects version, it says installed, yet it doesn't show up when I try to build it on webgl

#

this is my version for my project and the add modules button doesn't show up for it, I'm sure its a simple fix but I cant seem to figure it out (2021.3.16f1)

#

any help would be highly appreciated

astral wave
# dark comet but if there's a better way to do it please let me know

FindObjectOfType and all find functions are pretty slow, so it is better to avoid them in general, unless it is hard to crate refernce.

Let me explain problem you are having:
on Overseer Start you call UpdateHealth from UpdateLevels. This function requires healthText element. BUT this element is assigned on UpdateLevels -> Start() function

healthText = GameObject.Find("HealthAmount").GetComponent<TextMeshProUGUI>();

But if Both Start() runs at the same time, you can have racing condition, as Find is slow and it havent find the element when you Overseer asks for it.

For this you can:

  1. Quick solution, but ugly. Just replace start with awake on UpdateLevels. as Awake runs first and only then start. so you wil 100% sure that it will run.
  2. bit longer, but way better practice. Just make references on editor, and dont use Find at all. This will make sure there are no references missing. And make future you more happy when you will need to update code.
  3. Add if check:
public void UpdateHealth()
    {
      if (healthText is null)
      {
          healthText = GameObject.Find("HealthAmount").GetComponent<TextMeshProUGUI>();
      }      
      healthText.text = global.currentHealth.ToString();
      healthBar.fillAmount = (float)global.currentHealth / global.maxHealth;
}

Anyways I strongly suggest going with 2) and make you project cleaner and more easility to update in the future.

astral wave
#

Does Sprite rendered dont work on iOS webgl?

keen urchin
astral wave
tawny cargo
#

When someone clicks on my WebGL build it instantly goes to fullscreen. I want to keep it in the small rectangle at the start. is there a way to do this?

astral wave
tawny cargo
#

where do i see templates in build settings?

#

i found it under resolution and presentation. but the only two options are Default and Minimal.

astral wave
#

Default is the one I was talking, you can use that tempalte as example how to make what you want.

astral wave
keen urchin
random talon
#

I have a simple scene. I've tried to build and run it as webgl but the framerate is significally low, based on the window resolution I get from 45 to 60 frames while in editor i reach 350+

Here's the profile of the running webgl version:

#

Does anybody knows what could be going wrong?

random talon
#

To be more precise I even tried to build for Windows and in that case I get more than 240fps

#

So indeed is a specific WebGL issue

sweet oriole
astral wave
#

generally. not always. especially if have multiple monitors

random talon
#

I use only 1

hidden finch
#

Hi, in my WebGL Unity project I am using .svg graphics. That is why I had to add Vector Graphics to my project.
Problem is that when I am building project manually graphics looks good and everything is fine. But when it is built by Gitlab pipline and pushed to my server, .svg graphics is deleted and replaced by white squares.
I already add Vector Graphics to .gitlab-ci.yml, but nothing changed.
Any idea how to fix it? Or where I can find solution on my problem please?

ashen matrix
#

Hello,

i have an issue using an UI Button to open an external URL.

It works fine on DesktopPC and Android Mobile. But on iOS Devices nothing happens if i trigger the button.
Does anybody know what here could be the solution?

hollow falcon
#

is there a maximum fixedupdate refresh rate on webGL? i need fixedupdate called every millisecond but for some reason when i build for web it's only called every 16ms.

sweet oriole
#

FixedUpdate should run multiple times to catch up, but actually running it frequently might be a problem

hollow falcon
sweet oriole
#

Maybe there is some (likely quite involved) hack you could do, but I'm not aware of anything. First challenge would be to have anything in the browser run at that frequency, then seeing if you can somehow take that to Unity.

hollow falcon
#

alright, i'll keep digging.

sweet oriole
hollow falcon
#

thanks!

ashen matrix
astral wave
lyric sapphire
#

Hello, I hope I'm in the right place. I uploaded the Pachinko project from the Unity Essentials Pathway to Unity Play, but it came out zoomed in. I tried playing with the resolution, resizing the assets, resizing the main camera, but nothing worked well. Could anyone give me an idea what I might have done wrong so I avoid it in my next projects?

outer rampart
lyric sapphire
#

At first they were the default settings, I just went and selected webgl in player settings, put in the product name and clicked build. I tried different numbers but to no avail. Right now, on my latest attempt (which made it a bit better) I did 1370 by 600 (I was just fiddling, I know that's a weird resolution) and added a canvas scaler set to "Constant Pixel Size". About my browser being zoomed in, I double checked, it's on 100%. Still, I tried unzooming but the view stays the same.

sweet oriole
ancient rampart
#

Hi,
I'm am making a webgl build where users can select different webcams.
In the editor, I can switch between webcams using key presses and the rawimage will display the correct camera
However in the build, the rawimage will only display the first camera that is detected from webcamTexture.devices

I've tried

  1. Creating a WebCamTexture() without passing anything - this of course is always the first one
  2. Creating a WebCamTexture(insert_webcam_name) - always displays the first webcam in the rawimage, however the device name is correct
  3. Checking for Application.HasUserAuthorization(UserAuthorization.WebCam) before any webcam code gets run - although does seems to be an iOS code only, didn't seem to do anything in webgl. I tried my build in icognito so I can see when camera permission gets asked
  4. I did print out WebCamTexture.devices.name, and all my webcams gets printed out to the console.
  5. When switching webcam do webcamTexture.Stop() > assign webcamTexture.deviceName > webCamTexture.Play()
  6. When switching webcam do webcamTexture.Stop() > Creating a new WebCamTexture(insert_webcam_name) > webCamTexture.Play()
  7. When switching webcam do webcamTexture.Stop() > Creating a new WebCamTexture(insert_webcam_name) > rawImage.texture = webCamTexture > webCamTexture.Play()

All the above in the editor will properly display the correct webcam. In WebGL it does not.
I am using Unity 2020.3.24f1. Does anyone know how I can select different webcams in webgl build?

formal reef
ancient rampart
# ancient rampart Hi, I'm am making a webgl build where users can select different webcams. In t...

`public class WebCamScript : MonoBehaviour
{
private RawImage rawImage;
private WebCamTexture webCamTexture;
private List<WebCamDevice> webCamDevices = new List<WebCamDevice>();
[SerializeField] private RectTransform cam;
void Start()
{
StartCoroutine(RequestAuthroizeWebCam());
}

private IEnumerator RequestAuthroizeWebCam()
{
    yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
    if (Application.HasUserAuthorization(UserAuthorization.WebCam))
    {
        WebCamDevice[] devices = WebCamTexture.devices;
        Debug.Log($"number of devices is {devices.Length}");
        int i = 0;
        foreach (var device in devices)
        {
            webCamDevices.Add(device);
         }
        InitializeWebCam(webCamDevices[1].name);
    }
    else
    {
    }
}
private void InitializeWebCam(string deviceName)
{
    rawImage = cam.GetComponent<RawImage>();
    webCamTexture = new WebCamTexture(deviceName);
    rawImage.texture = webCamTexture;
    rawImage.material.mainTexture = webCamTexture;
    webCamTexture.Play();
}
private void SelectWebCam(string deviceName)
{
    webCamTexture.Stop();
    webCamTexture = new WebCamTexture(deviceName); //I've also tried doing webCamTexture.deviceName = deviceName
    rawImage.texture = webCamTexture;
    rawImage.material.mainTexture = webCamTexture;
    webCamTexture.Play();
}
private void Update()
{
    if(Input.GetKeyDown(KeyCode.A))
    {
        Debug.Log("A pressed");
        SelectWebCam(webCamDevices[0].name);
    }       
    if(Input.GetKeyDown(KeyCode.B))
    {
        Debug.Log("B pressed");
        SelectWebCam(webCamDevices[1].name);
    }
}

}`

ancient rampart
# ancient rampart `public class WebCamScript : MonoBehaviour { private RawImage rawImage; ...

Still not resolved yet, but originally I had my webcam code in my current project. So I thought it was possible that something else in the project was messing it up. So I created a new webgl project. Added a rawimage and attached a material. Using the code below, this is working flawlessly in editor, but in webgl build it only sticks with the first camera. What's confusing me is that I am initializing webcamtexture using index 0 camera or index 1 camera, it always displays index 0 camera.

I also thought maybe it was a browser issue so I tried both Chrome and Firefox, but issue still occurs

[EDIT]
I tried a PC build instead of webgl build with the same code. PC build works perfectly fine just like in editor. It's only WebGL. Maybe there's a rule in WebGL that I missed in the documentation?

charred briar
unborn nest
#

WebGPU is a new Javascript API bringing more featureful access to the GPU while being more idiomatic to JavaScript. WebGPU is now being released in Chrome so websites can start relying on it. This session will describe WebGPU's history, show demos covering various aspects of how WebGPU improves compared to WebGL, the current alternative, and giv...

▶ Play video
astral wave
# ancient rampart Still not resolved yet, but originally I had my webcam code in my current projec...

Well webcam have tons of fun on webgl. There are multiple steps. First, depending on device, you might need to interact with application before you can use camera or mic. Second, before using I suggest to refresh the list, as it might have changed when you interacted with it, so accesing [0] not always will give result you want. These a small tips you might want to look at.

ALSO MAKE SURE YOU USING HTTPS. As without secure connection it will not let you use devices.

astral wave
#

Hey, question about 2023 adaptive probes volume. I know it is more performance demanding than legacy probes, but is it still more performant than Real time lights right?

ancient rampart
# astral wave Well webcam have tons of fun on webgl. There are multiple steps. First, dependin...

thanks for the tips! I did notice that the first time I enter the app, only the first camera got detected, but everytime after that, it will detect all the cameras. I did print out into the console the list of my cameras so I know which camera is at which index. Also used keypress to change to different cameras at index [0],[1] and [2] but it always stayed at [0].
And yes, I'm using HTTPS! 😄

weak nova
#

Hi, i know this isnt specifically of webgl, but i didnt know where to write it, basically my game is using webgl and i have player wepon skins in a database where i can just use one string to storage values, so i separate Texure url, value, weaponType etc.. by a sybol (#), the problem is when i retrive the values i do a Tryparse to convert that strings to the ints and floats, and they dont work, just the strings, if somewone wants i can send screen capture

astral wave
#

MediaDevices.getUserMedia() and Application.RequestUserAuthorization might be needed to get permisions first

fickle thorn
#

how can I make unity webgl webrtc video chat project?

#

@here who can help me?

astral wave
#

Personally would go with second choice. The first one tested and works without problem, but second one sound pretty nice. also both have documentation which you can folow for your project.

jolly lion
#

What are my options if I want to play videos in my project that will be hosted on a website?

astral wave
fair swallow
#

so when running my project on my pc it always just looked good, but when i build it in webgl, it is zoomed in for some reason, any ideas why?

fair swallow
#

fixed it: changed resolution in player settings ^^

light rampart
#

Hi there
I'm having trouble to build my WebGL project because of this error
Shader error in 'Universal Render Pipeline/Particles/Unlit': HLSLcc: Bitwise integer instructions are not supported on GLES 2 (on gles)
when chosing Auto Graphics API or just WebGL 1 in the player settings
but when I chose WebGL 2 on purpose, the error disappears, but my regular Lit materials become pink
anyone everhad that kind of error?

ancient rampart
# astral wave https://docs.unity3d.com/2022.1/Documentation/Manual/webgl-browser-access-device...

Thanks for sharing that link! I have always been able to print out the correct webcam to the console, but it's the RawImage that does not change to the correct webcam. When I first enter the app (using incognito), only the first webcam would get detected, even if I do Application.RequestUserAuthorization(UserAuthorization.WebCam) first. It would be until WebCamTexture.Play() gets hit and then I refresh the page then would all the webcam get detected - However, the rawImage still does not change even though the console prints out the correct webcam. I tried your link and also tried the solution here https://answers.unity.com/questions/909967/getting-a-web-cam-to-play-on-ui-texture-image.html but same result. I'm not sure where to apply MediaDevices.getUserMedia

astral wave
# ancient rampart Thanks for sharing that link! I have always been able to print out the correct w...

Please have in mind, that on some devices you cannot run Play automaticly, and first user needs to interact at least once with application (when audio is not muted, and on iOS sometimes even when audio muted)

Another common error is when Canvas or Material it self don't get updated. Let me expand about it a bit more. The best if you could test this on your editor, as it is easy to notice by disabling and enabling your UI element that uses webcam texture. Sometimes the UI dont get "dirty" and it thinks that there is no update on texture and does not update it. So in the start it sees it as empty and after that does not automaticly check if texture have actually changed and does not render webcam image. If this is the problem disabling and enabling UI element that Raw imagie is on, will set it dirty in editor and you will see the image. On non editor there are scripts to make it dirty

tawny cargo
#

I'm trying to publish a WebGL game on my site. It was breaking with compression so I'm not compressing it.

https://galahadgaming.com/Games/2023Build/

for some reason it no longer does the Unity Loading screen, it's just a black box until it eventually starts. Also sometimes it doesn't load at all.

Does anyone have experience with this or know what I've done wrong?

median rain
#

hi everione..
one of you guys already found a solution to stream-audio on WebGL?
i want to record microphone but realtime... so i want to captuer streamed microphone to Unity

#

i got a way to capture 'N' time then send to Unity, but, i want to capture streammed audio to unity and maybe get streammed audio to the page at minimum

ancient rampart
# astral wave Please have in mind, that on some devices you cannot run Play automaticly, and f...

that's cool, I didn't know there was a thing called "dirty"! So according to the description on SetDirty "You can use SetDirty when you want to modify an object without creating an undo entry, but still ensure the change is registered and not lost. If the object is part of a Scene, the Scene is marked dirty."
So this could be useful because I am changing the rawimage - and SetDirty could register the change?

I've tried SetDirty, but it seems like it's only an Editor code since an error gets thrown while it's building. Is there another "SetDirty" from a different namespace that I'm missing? And also the namespace us UnityEditor. See SetDirty_Error.png as an example

I've also attached a screenshot of the inspector for my raw image and material. I think I've set them up correctly. See RawImage.png.

I was also paranoid it was an Unity version issue so I tried 2020.3.48f1, and the same issue occurs (I'm on 2020.3.24f1)

astral wave
astral wave
ancient rampart
# astral wave if you changing unity versions change to 2022. It have quite a lot WebGL improve...

I was changing unity versions just to see what happens, but I'll try your suggestion with 2022
But in Unity 2020. I tried SetAllDirty before WebTexture.Play(), and still doesn't work in webgl build haha. This is such a mystery 🕵️ . See SetAllDirtyBeforePlay.png
In Editor, switching webcam has always been working with or without SetAllDirty

WebCam.mp4 is an example of the webgl build. I am pressing "A", "B", "C" to switch cameras. You can see no matter which one I select, the rawimage displays the same camera but from the text you can see the camera is detected.

ancient rampart
astral wave
tawny cargo
#

my webgl build works, but the first time the player clicks the game goes fullscreen. i do not want this event to happen.

trying to research and i keep finding articles with fixes saying the same thing


I removed "(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf("Safari")==-1||s>=10.1)?1:0" from the "hasFullscreen:function()".

B E F O R E :

hasFullscreen:function(){var e=document.createElement("canvas");return(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf("Safari")==-1||s>=10.1)?1:0}

A F T E R :

hasFullscreen:function(){var e=document.createElement("canvas");return}

But I can't find any file called UnityLoader.js in the build directory. Any thoughts?

I only want my game to exist in the small starting webGL window

tawny cargo
#

All I need is to stop the game from going full screen when it gets clicked on, it looks perfect once I press the escape key

tawny cargo
#

In Resolution and Presentation I have selected
width = 960
height = 600
Run In Background: unchecked
webgl Template: default (only 2 options are default and minimal, I don't like how minimal looks)

tawny cargo
#

I see under Player>Resolution and Presentation
there is an option to switch from full screen to windowed
but that is for a Windows/Mac/Linux build, not a WebGL build

astral wave
dull quest
#

ok another webgl error on 1st attempt on browser

#

I've been set such configuration on about:config according to the tutorial

#

also set the compression to disable, but still it remains error on mozilla

#

*my build runs decent at itch .io

#

let me know if you guys notice this
thanks in advance

median rain
#

you should load project from a host in your machine, use Xamp, Wamp, or something, then add into a folder on your localhost

tawny cargo
keen urchin
# dull quest

This is intended behaviour
WebGL builds are not standalone applications

astral pebble
#

Should I be worried about my game not using any compression method?

#

gzip is giving me weird errors

#
Unable to parse Build/Build.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug.```
sweet oriole
#

The error is pretty common and pretty likely to be accurate.

frank dove
#

Hey guys maybe someone can help me here, I have a WEBGL project where I use Unity Multiplay API'S to allocate servers. The problem is that my API response is getting blocked by CORs.
I disabled CORs on my browser and it worked fine, how can I setup custom headers on the Unity multiplay servers?

fair swallow
#

i made a small game where i save data to 2 different textfiles, put if i build it as webgl, only data gets written to one of the textfiles and the other is always empty for some reason. Any ideas?

astral wave
#

just can't.

fair swallow
#

makes sense honestly

#

but i dont understand why certain data does get through

#

to the other scene

astral wave
#

if game object is not destroyed, for example is DDOL, it will transfer to other scenes without problems.

fair swallow
#

but the way it works its like, they save it all to textfile on one scene, and load them back in in the other scene

#

but that shouldnt work

#

but it works

astral wave
#

or it is scriptable object, it will also get transferred to other scenes. but reseted on game reload.

astral wave
fair swallow
#

i just write to a txt

astral wave
#

it most likely load data from reference of previous writing. Or load default data that you had on build.

fair swallow
#

from a static class

astral wave
#

static class also dont get their data deleted on scene transfers

#

tho I might be wrong on this one.

fair swallow
#

i did try that

#

because not all data got transfered

#

so i saved in a static list

#

but that didnt switch through

#

but ill just hardcode the data for now and ill let the next person fix the problem

astral wave
#

why you use text files? you want to continue from wheere you started when start game again? aka save file?

fair swallow
#

no no

#

only in the same session

#

i want it saved

#

different session different data

astral wave
#

Use scriptable objects or DDOL.

#

or unity have extra feature for that as well called (let me google it)

#

User preferences I think

fair swallow
#

could be i have heared that before

astral wave
#

But most common way is to use DDOL

#

dont destroy on load

dull quest
astral pebble
#

Do you guys recon it's a good idea to use firebase for authentication on the website where I will be hosting my game?

spice crystal
#

Can anyone assist me how do i setup a websocket for my game

#

My unity game is WebGL based but it wont let me connect because of websocket

#

Also let me note my game is multiplayer

dull quest
#

or do you need some login/registration system ?

dull quest
spice crystal
#

@dull quest can you assist me

dull quest
spice crystal
#

its with webgl and websockets

dull quest
spice crystal
#

?

#

no

#

this is my name for like a few months

#

what does my name have to do with anything

dull quest
#

I recall ur pic, read my dm pls

spice crystal
#

alrighty hold up

sleek thistle
#

Anyone have any success interfacing with Wix?

#

Looking for help fetching a product dtabase

solar palm
#

hey, ive been using unity 2020 for a while. i'm planning to make a simple point and click webgl game.
i've been primary making games on Steam, but kinda new when it comes to making webgl games.
i'm curious if there's any advantages to using unity 2021 / 2022 for webgl specificly, if its stable or more broken than 2020. any thoughts?

normal bough
#

When i build with webgl I dont get an index file anyone know why

sweet oriole
normal bough
#

build and template data

#

I get soem errors as well

#

i got it working and uploaded it to itch.io but when i try to open the game i get stuck on this

sweet oriole
normal bough
#

I think its the compression issue

#

why is it cut off

#

nvm fixed it

tranquil dagger
#

Will I still make profit from making games on webgl on itch.io?

keen urchin
full smelt
#

ok so i am trying to build my unity game into a webgl or html but when i open it from my file explorer i get an error saying something like "both async and sync fetching of the wasm failed" or something and then the game won't load, how do i fix this

sweet oriole
astral pebble
#

It's alright I got it mostly sorted

#

Though I have a question about WebGL: Can I use the job system if my game is going to be in WebGL?

sleek thistle
#

Howdy, new here and just getting started with integrating my apps with a site. Looking for help with retrieving a product list from my site. I already setup the function and the database but when I make a webrequest from my app I get error 404. Are there any unity specific examples or resources available or can anyone help?

My end goal is to select a product and launch a 3d model viewer for the selected model. Not sure how I should be going about persisting the selected product name so that the model viewer (embedded webgl unity app) can fetch the product name and load the correct model.

sweet oriole
errant cipher
sleek thistle
#

you could try manually setting in to active

#

*it to active

errant cipher
sleek thistle
#

I had an issue like this so I just placed a button over the input field and in the onclick I dropped in InputField.ActivateInputField

#

This was a VR issue though. But you could put in a dummy button to test to see if tha is the issue

#

just set it active using the button and see what happens

errant cipher
errant cipher
#

Okay figured out how to make it work. This is attached to the gameobject with the TMP Input Field.
When the field is selected it opens the keyboard and updates the input field text in a coroutine.

    public class UIInput : MonoBehaviour, ISelectHandler
    {
        [SerializeField]
        private TouchScreenKeyboardType _keyboardType = TouchScreenKeyboardType.Default;
        private TMP_InputField _input;

        public void OnSelect(BaseEventData eventData)
        {
            if (!TouchScreenKeyboard.isSupported) return;
            var keyboard = TouchScreenKeyboard.Open(_input.text, _keyboardType);
            StartCoroutine(GatherInput());

            IEnumerator GatherInput()
            {
                yield return null;
                while (keyboard.active && _input.isFocused)
                {
                    yield return null;
                    _input.text = keyboard.text;
                }
            }
        }
        private void Awake()
        {
            _input = GetComponent<TMP_InputField>();
        }
    }
tacit dome
#

is LINQ supported in webGL builds? Doesnt seem that Distinct() likes them very much.

normal bough
astral pebble
keen urchin
astral pebble
keen urchin
astral pebble
#

How come?

keen urchin
# astral pebble How come?

Jobs is efficient because the code runs on multiple processor threads
If WebGL can't support it, it'll fall back to just the one primary processor thread

astral pebble
#

Ahh right

#

Yeah online it says webgl is single threaded

#

But that was in 2018

#

It looks like in 2020 there was a way to enable multi threading but it was still being developed

#

Idk I’m just worried about pursuing making my game on the browser in case it is super slow

#

I really wanna make it through webgl but online I’m seeing a lot of people advising against using unity for webgl games

keen urchin
astral pebble
#

Where can I find those limitations?

#

I just wanna make sure that I can actually use WebGL for my game, since it’s my uni project for my last year

keen urchin
astral pebble
#

alright thank you!

dull quest
normal bough
vestal cloak
desert nexus
#

Does unity webGL support compute shaders?
Online I find conflicting information

#

Thanks in advance guys

sleek thistle
#

Anyone here using WIX or squarespace to host there apps? or is everyone using itch?

sweet oriole
white basalt
#

Anyone have any ideas how I can stream live into my WebGl 3D site via my Rokoko mocap suit and Unity? I am using a mirror server setup...

random talon
#

Probably a niche question but does anybody knows a plugin/script that is able to do lipsync at runtime by listening the audiosource?

#

Every plugin I tried didn't worked on WEBGL

lost saffron
#

I ran into a problem with WebGL and Addressables. When I load an asset, the shaders don't get initialized somehow? The objects and materials are all there, but they are invisible. When I switch to other platforms, this does not happen.

formal reef
random talon
#

while polly ha no runtime option, it just outputs a viseme list with timestamps

formal reef
formal reef
#

A-Frame, Needle Engine, Threejs, etc

lost saffron
random talon
random talon
#

I need understand how I can manage an audio track on WebGL

#

Basically the sites that host also the webapp I'm building on Unity at a certain times emits an audiotrack

#

Now is it possible to receive it inside the unity app at runtime and play it through the audiosource instead?

sweet oriole
#

There are voice chat plugins that transfer voice data over JS websockets and convert it into an audio clip, so at least that stuff should be viable.

random talon
#

Any idea of what I should look for? Web stuff its really obscure to me

#

But at least I got lipsync at run time on webgl working

#

so I only need this last part where the backend of the website gets the synthetized speech audio from an api and send it to the unity app that plays it

lost saffron
random talon
lost saffron
random talon
lost saffron
#

Any good ways to make MQTT work in WebGL?

jolly lion
#

Got a question for those that have done so already: I have created my project ready for webgl and I'm going to put it onto my website that will act as a portfolio. What's the difference between using an embed of the project and just hosting it on the website?

orchid bridge
orchid bridge
jolly lion
wispy marsh
#

any help?

astral wave
# wispy marsh any help?
  1. open browser console f12 and see actuall error instead of this.
  2. does your editor have ANY red errors on testing?
  3. Build developer build and enable full stack logs in Player build settings.
  4. inspect the logs.

If these wont give you answer, then write answers to these questions and others might help. currently we cant

random talon
#

I'm still trying to figure out how get text-to-speech audio from Amazon Polly in unity WebGL at runtime and still getting errors.

Here's the code I use: https://hatebin.com/klhdbrqkmj

It works fine in editor but once on web build I get error, at the line where the '//(!)' is

#

I get the 'filestream null' issue could this be caused by the WEB build not be able to have multiple threads?

astral wave
#

But code you posted have no multithreading. Tho I am pretty sure you cant write to file on webgl either. Aka you dont have any local storage, only memory. So it works bit differently

random talon
#

Cause for now I have a very good pc and get around 60 frames while on editor is 200+, I know that performances on browser are limited by it but on low end pc it runs bad even if its just a 3d model on a blank scene

astral wave
# random talon Cause for now I have a very good pc and get around 60 frames while on editor is ...

2022LTS does not differt alot from other 2022. but it have nice features if you go from preivous versions. I would say a must update.

BUT: 60fps is most likely because you are having 60hz monitor, as browsers by default limits your frame rate to your monitor refresh rate. So you cannot run webgl faster than 60 even with monster PC.

But if it goes to lower than 30 I would be worried about optimisations. Are you running URP rendering pipeline? there are quite a lot of quality settings you could play with. Also Unity profiler is very handy, it is bit difficult to run it on webgl, but possible.

random talon
astral wave
random talon
astral wave
# random talon with low end pc i mean an ordinary 300-400$ laptop

It is really hard to tell I am sorry. I would need to see to say anything else. But it is very common on webgl to run like shit. For example in our project we have Streaming video feature, on editor you can stream high rez videos with 200+ fps without problem, same pc on webgl and video streaming on? barely 60 fps. So things like video encoding on webgl is horrible.

#

but it might not apply to your project at all

random talon
#

I'm trying to integrate the unity web build on the site but I got this errors, any idea of what causes them? Is it on the site end or on the unity app end?

random talon
#

actually where can I see how host a webgl game on a website? Look like after 2020 unity changed they way its webapp must be handled

rotund hemlock
#

Yes I am building an app I like to make beer money off of, I second the question above. I'm not sure if steam supports it

astral wave
normal haven
#

Hi there! i'm trying to take a screen shot in game and download it as an image, and i'm having a "overload resolution failed" error.
I'm doing it with a JS api

public async void Screenshot()
    {
        Texture2D tex = await GetComponent<Camera>().TakeScreenshot();
        string base64 = Convert.ToBase64String(tex.EncodeToJPG());
        Api.DownloadImage(base64, "Screenshot");
    }```
And API side (tw: not c#)
```js
window.odyssiApi.downloadImage = function(base64Image,fileName) {
    const aElement = document.createElement('a');
    aElement.setAttribute('download', fileName);
    const href = URL.createObjectURL(base64Image);
    aElement.href = href;
    aElement.setAttribute('target', '_blank');
    aElement.click();
    URL.revokeObjectURL(href);
}```
My hypothesis is that the base64 string is broken somewhere, and idk where/why/how to solve it
faint compass
#

when building with the defailt windows thing my project builds fine but when i try to publish or build it with webgl it gives me the error in the attached image

sweet oriole
fierce cave
#

I am facing a webgl memory issue so I built a empty project from Unity 2022.3.0f1, it run well on local but wen I upload it to s3, the JS Memory take too much memory, anyone know the reason?

#

it also happens on local when I try to reload the page several times, when I develop the game to Facebook webinstant, in some low devices, players can't event load the game (stuck at 90%), I think they are out of memory then make the browers crash.\

fierce cave
#

@barren pollen

barren pollen
#

Does any one know about this problems? I have no ideal about this.

austere tiger
orchid bridge
orchid bridge
fierce cave
#

Thank you! Btw I have an error when set the exeption support to none. The game works well again when I set it back to withoutFullStacktrace. Do you know how to fix it?

sweet oriole
fierce cave
#

Thnak you! I think so

fierce cave
#

@sweet oriole the only red log that I have is
does it effect to the exeption support?

soft monolith
#

Anyone tried to generate a pdf with info and screenshots from unity webgl? I searched a bit on the internet but couldn't find any definitive answer.

pastel sedge
fierce cave
# fierce cave

for this one, I just figured out that some addressable function throw exception in Webgl. Do we have any document/tip for using addressable in Webgl?

sweet oriole
dusky prairie
#

can sb help me with my webgl built? i have it online and i get 2 errors on loading. should i post the errors or the link to my build in order to see for yourself?

dusky prairie
random talon
#

What's the easiest way to get an MP3 from a website backend where my WebGL game is?
I read that the backend should convert the mp3 into an array of bytes, then into a string and then send it via the SendMessage.
Does exist a more simple way?

#

(No I can't use a webrequest to a link since this MP3 gets generated at runtime and its always different so I guess can't be hosted into a link)

blazing tide
#

Hi ya, trying to get a web gl built, I have 8 errors.... not sure why.

#

Tried changing the build location to another drive and worked fine 🤷‍♂️

desert nexus
#

Hey guys,
Quick question.

Since computebuffers are not supported for WebGL can I use a graphicsBuffer (as second vertex buffer maybe?) and send some data over in buffer format that way?
Thanks guys

fierce cave
random talon
#

https://hatebin.com/uaifbmpagy

This is the code I use to receive an mp3 that was previously converted into an array of bytes and then into a string to be able to enter in a SendMessage()

It works like a charm on unity editor but doesnt work on WebGL, probably due to the limitation to not be able to use 'Application.persistentDataPath' and other local memory related things once hosted on website.

Can somebody help me out figuring out if its possible to convert it?

random talon
#

I initially used it on editor and got a warning from unity that suggested to switch

#

haven't tried www on webgl build tho

outer rampart
random talon
#

Sorry I've never used webgl before, can you explain better?

outer rampart
#

The persistant data path is a link, since your files are hosted online (;