#๐ŸŒโ”ƒweb

1 messages ยท Page 4 of 1

outer rampart
#

Maybe I can find an example

random talon
#

with online do you mean on the webapp right? cause I just receive a string and then I elaborate that at runtime on unity

#

Its now an mp3 I download froma link

outer rampart
#

For a rythm game I used this

#

For StreamingAssets

random talon
#

So the trick is in " using (UnityWebRequest www = UnityWebRequest.Get(Application.streamingAssetsPath + "/" + fileLocation))" I guess

#

but still I can't figure out how integrate this inside the code ๐Ÿ˜

#

Also seems that you are not even doing the conversion from []byte to AudioClip which is the only step I need to complete it

fair swallow
#

before i actuall try, i wonder. Can you read out and save to external textfiles in webgl

flint tree
#

I tried to export my game to html, put it on itch.io, and its giving me this error on the itch page

"Unable to parse Build/Raining Heads.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."

sweet oriole
flint tree
#

oh wait i found it

empty jacinth
#

hello, can anyone help me? I am using unity 2019.4 on ios, but I cannot seem to find the option to add webgl.

fierce cave
#

Anyone know what is it? I want to set Enable Exeptions to none but I alway have this.

#

I am using unity 2022.3.1f1

astral wave
#

please make a bit smaller screen shot with less information. Most likely something with allocation. Do you have any warning or errors on editor? as it might work on editor even with errors, it wont work on webgl on any error happening. Also would suggest use Developer build with full stack trace logs to get more data about error.

fierce cave
ashen matrix
#

Hello,

i've got an WebGL Project, which crashes on iOS/Safari. In the console i got these Errors (WebKit)

In Desktop i get different error, like in the second picture. Does anybody know, what is happening?

fair swallow
#

Is it possible to debug a webgl build in the unity editor

astral wave
astral wave
astral wave
fierce cave
# ashen matrix Hello, i've got an WebGL Project, which crashes on iOS/Safari. In the console i...

for the fs.sync, please follow Keli from this discussion: https://forum.unity.com/threads/warning-x-fs-syncfs-operations-in-flight-at-once-probably-just-doing-extra-work.447255/
for other ones, I have no idea.

astral wave
#

put everything on none

ashen matrix
fierce cave
astral wave
fierce cave
astral wave
#

if you want to remove all logs you can use java script to remove it at all. but I would not recomend. I would try to find what causes te error instead. so for that would go totally oposite, would put all logs on maximum with full stack trace and would fix it.

fierce cave
#

when I am testing, the webgl build still got that error even I catch the exeption

fierce cave
#

so to set the Enable Exeption as none, I assume we have to make sure our projects don't throw any exception, even we catched it.

errant terrace
#

Fire storage image URL cors error in Unity

Hello. When I make a request to the link of one of the images in my fire storage database, I get a CORS error (e.g.: Access to fetch at 'https://firebasestorage.googleapis.com/v0/b/virtual-museum-3e14f.appspot.com/o/artwork-images%2Fexponat1.jpeg?alt=media&token=060221c5-dd38-44ff-a005-119e9f798125' from origin 'http://localhost:4200/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled).

Accessing the link in the browser works fine, but not in the Unity WebGL app. It all also works properly in the Unity editor. Just not in the Angular UI (where the Unity WebGL app is integrated).

Is there a setting I can make on firebase to disable CORS?

THANKS!!!

Note: I don't use Firebase in Unity or C# at all. I just have the link to some images stored in fire storage, that's it. In Unity I first have the request to the node server, to obtain the url.
Then I have another request to Fire storage for obtaining the image I need.

thorny parcel
#

Hey all. Maybe somebody can help me here. I uploaded a project to itch as a web gl. Sound crackles and then goes silent. Using unity 2020. I've uploaded web gl games with unity 2019 and never had this problem. Is there a known bug? Thanks.

astral wave
astral wave
thorny parcel
astral wave
#

How you guys handle videos on iOS webgl? As we all know user needs to interact to play video with sound. Muted one should autoplay without interaction. How you handle that "interaction".
Previously I used pointer down event, as click event on UI does not trigger interaction for some reason. But now I have strange bug that even previous method don't work.

So I was wondering if anyone have better approach or different approach.

charred sparrow
#

Hey everyone, quick question I can't figure out:
When hovering over a button I want the pointer to turn into the hand. I have watched some tutorials and they involve OnMouseEnter/OnMouseOver etc, which is fine but they also upload an asset to act as the finger. Is there a way to just use the default hand and finger?

Thanks

astral wave
# charred sparrow Hey everyone, quick question I can't figure out: When hovering over a button I w...

Most brain dead method is using those tutorials and just use default hand and finger images instead of custom. But In general Idk how it will work for you in webgl, unless you Focus window and wont let mouse leave your canvas until you press esc or something then it is fine. but if you want free mouse... you cant do it, as it wont change it look on browser, and in game you will just see two mouses ๐Ÿ˜„

charred sparrow
median rain
#

hello guys, does any one knows how can i simulate/Run the OnAudioFilterRead apropriattely on WEB-GL?
What i knoiw is this meythod running on another thread, and it is a pre-process audio phase of Unity....
for some reasons the only way to run my system is by this method; so i want to maybe, wait the pre-process audio phase of page then get from javascript on UnityInstance on all the MonoBehaviours that contains this method then call it...or something like that...
does any one knows how/what can i do it?

plucky hearth
#

i am looking for help on the propper way to do a WebGL build, the people i hired to make a website for me are haveing issues useing my builds

#

is anyone availiable for a discussion ?

astral wave
fierce ingot
#

Got a niche problem with webGL. A rawimage displaying a camara on a UI canvas disappears when the webGL player goes into full screen, and doesn't come back when you escape back to native size. BUT if you make it full screen while it is loading, it works fine. Other elements on the UI on the same canvas are fine. Just this rawimage.

#

Oh and it has a shader graph on it

#

The rawimage that is

#

Let me turn that off to see if that's the issue

#

Nope. Using basic URP shaders cause the same issue.

astral wave
#

indeed niche problem.
Is that canvas world space or overlay canvas?

#

Anyways I would try creating a button which turns off and on the canvas. If after that it is visible, that it might be a problem with canvas was not redrawed when scaling up, you can try force canvas redrawing on fullscreen mode.

#

if it is worldspace then make sure it does not share same plane as oter object, make it just a bit in front of it.

#

and lastly you can change the draw priority importance of canvas and see if that changes anything

fierce ingot
#

Canvas. Tried "turning it off and on again" with the raw and it didn't work but not the canvas. Gave that a go and not dice. Tried changing priorities but again, the other UI elements are unaffected. It's just this raw image.

fierce ingot
#

Anyone know how to use ForceUpdateCanvases()? Unity docs are trash and VS just throws a "cannot be accessed with an instance reference" at me.

fierce ingot
#

Figured out how ForceUpdate worked but it didn't help

hexed prawn
#

Hello, I'm having a weird bug with the unity version 2022.3.3f1, I'm trying to build the WebGL project and I get this:

Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
Exception in thread Thread-2:
Traceback (most recent call last):
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\threading.py", line 926, in _bootstrap_inner
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\threading.py", line 870, in run
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 1238, in _readerthread
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\cp1252.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 29: character maps to <undefined>
....

(I can send the full error if you want)
and previously this project was building perfecly fine at version 2021.3.11.f1, does anyone knows what could be causing this?

peak crown
#

Does unity support webgl builds for URP Projects?

orchid bridge
cerulean wedge
#

Hello, for some reason my project cannot load past the 90% mark, in a local build. With Build and Run, same in a github page site

Compressions are already completely disabled

cerulean wedge
sly wave
#

HI. Anyone familiar with this warning?
WebGL: CONTEXT_LOST_WEBGL: loseContext: context lost

the result is a blank page on the browser. I'm not sure if it's related to the memory occupied by the application, because the Unity app doesn't crash (I still see the logs in the console) when there is a blank page.

desert nexus
#

I have been profiling my webGL build for some time now, and noticed something weird. In some frames (Here highlighted using the red boxes) it spends quite a bit of time in these functions: JS_Sound_SetListenerPosition and JS_Sound_SetListenerOrientation.
I dont need sound in my case, this is completely wasted performance. Is there a way to hard disable this for a build? Or in any other way optimize this out?

desert nexus
keen venture
#

where can i publish my game its 500mb big i cant do it on itchio 200mb is max someone knows how to share big games?

sweet oriole
#

Use build inspector tools to see what is taking all that space.

slender shell
#

Iโ€™m new to unity and Iโ€™m trying to publish a game to itch io, it works fine in unity but when I build it and click start the game doesnโ€™t play. It might be because the game starts at a time scale of 0 and when start is clicked it goes to 1 but idk

#

Also, how do I make the game format depending on the device?

sweet oriole
sweet oriole
slender shell
sweet oriole
slender shell
#

Alright thanks!

sweet oriole
keen venture
#

where can i get it

sweet oriole
#

I believe there's one in the package manager and some you can find on github and the asset store.

keen venture
#

the one in the packet manager

agile cliff
#

hello! Anybody experiencing issues about shareds using latest unity + webgl + dots ?

#
Hidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)

Hidden/Universal/HDRDebugView shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
astral wave
#

who will bring him bad news?

agile cliff
agile cliff
astral wave
fierce ingot
#

Oh that issue I have with the raw image disappearing when you resize? Only happens on Chrome. Because of course it does. Firefox has no issues.

peak crown
#

I have a saving data script that stores the data in a persistent path locally, but it doesn't work on webgl build because im calling that saving data script using OnApplicationQuit method, which doesn't get called when exiting the testing website and re-entering, how can I tell the website to run that script once the player exits or refreshes the website?

ashen matrix
#

hello,

is it possible to include 2 Funktions to an webGL projekt? It should work also an android and iOS?

  1. Ui Button, on tap a specific telephone number is calles.
  2. UI Button , on Tap the Data like name, adress and telephone number is saved to contacts

thx ๐Ÿ™‚

gusty heart
#

Hello, I'm new to Unity. I bought an asset called Suntail Village, and ran it with webgl just for a test.
And then I recognized that there is a flickering issue, all the grasses and foliage that used the same shader had the problem(although I don't know if this is the main cause of the problem)
I found others who also had flickering issue as well, they said changing the clipping plane range of the camera was the solution, but it did no help for me. Does anyone have any idea how I could fix it?
I would appreciate any answers ๐Ÿ™ ๐Ÿ™
(I'm re-posting this because no one has answered me)

wicked dew
gusty heart
#

I don't think it is, because I tried with the wind blowing animation option turned off, but they still flickered when the camera moved. They are also perfectly fine when it is run in unity engine itself.

gusty heart
#

I found that they are flickering only when an object is behind it

median rain
#

disable Shadows on your grass

ashen matrix
astral wave
gusty heart
# median rain disable Shadows on your grass

I did disable shadows on my grass and it works perfectly fine in unity engine or when I run with Mac.
It can be seen it is the shadow problem but they suddenly become translucent sometimes

#

I enabled the development console and it says this

gusty heart
#

actually, the errors in the console was about different thing and I just checked the read/write option of the barrel model and it was fixed

#

When I checked strict shader variant matching in the player settings, though, the flickering disappeared but these errors of the foliage shader appeared.

#

Also, these pink planes from the blend model appeared
and they somehow become transparent in the shadows

lusty zephyr
#

Hi, I have built and uploaded my webgl game to unity play. But it only loads upto 90 % and stops. Can someone help me to solve this ?

sweet oriole
cosmic canyon
#

Hi, how can I open my webgl game after I built it. I tried opening the index file but it just gives me error, do I need to deploy it?

arctic rose
#

Depends how you opened it and what the error is

#

If you want to open it locally on your own computer then choose Build and Run in Unity

cosmic canyon
#

Is build and run the only way to open it locally?

arctic rose
#

No, but it's by far the easiest

lusty zephyr
sweet oriole
calm reef
#

Does anyone have a guide for perf and optimization for webgl?

unreal vigil
#

HI GUYS i need help in webXR ,i need to pick an object using handtracking in webvr how to do?

polar cobalt
#

I'm trying to upload a WebGL build, but once I get it to processing it stops working. It will start on 2%, but then revert to 0% and stay there. Is this normal or am I uploading it wrong?

#

crickets intensify

#

Nevermind, I resolved it. I mistook the wrong file for the build file.

echo cradle
#

nvm i think its good

manic plume
#

If I set enable exceptions to none, the webgl build pauses on error, is there anyway to make it continue playing?

round kestrel
#

Please help, when I put webGL onto Unity play, I keep getting an error of a directory not found exception of the folder I literally just put it in and exists
How do I fix this

This hasnโ€™t happened before, I donโ€™t know whatโ€™s wrong

sweet oriole
#

Posting complete errors could also be helpful

round kestrel
#

And also it just opens my browser and I pretty much click save and itโ€™s done

sweet oriole
round kestrel
#

Oh ok

round kestrel
#

The not found folder error

sweet oriole
#

Just restarting Unity didn't fix it?

random talon
#

Does anybody knows how I can communicate from the Unity WebGL app to the react of the website the game is hosted?
I'm struggling to find any useful documentation and some ways that gets suggested on the documentations are obsolete and not supported anymore

high patrol
#

So an embedded unity webgl game is a react component, so you would need to pass data to and from that component like you would any other react component

obsidian iris
#

Hello there, the other day when I was building my game for the GMTK game jam It wasn't working. Today I decided to try to figure it out and found that using await Task.Delay() causes the build to shit itself and stop working without throwing any errors into the console. Anyone know if this is just something to do with async and WebGL or if there is some setting I'm missing somewhere?

sweet oriole
random talon
high patrol
#

but you could include something in your app.jsx that talks with your js plugin

#

so that C# can call that unmanaged js, and then the unmanaged js passes it along to the react component

random talon
#

With the react-unity-webgl library, you can establish bidirectional communication between Unity and React. To call methods from Unity to React, you can follow these steps:

  1. In your React component, define a method that will be called from Unity:
function myReactMethod(parameter) {
  // Perform actions in your React component
  console.log("Received data from Unity:", parameter);
  // Perform any other actions with the received data
}
  1. In your Unity project, use the SendMessage function to invoke the method in React:
// Call the method in React from Unity
gameObject.SendMessage("myReactMethod", "Hello from Unity!");

In this example, gameObject refers to the GameObject in Unity that contains the script responsible for sending the message. "myReactMethod" is the name of the method defined in your React component, and "Hello from Unity!" is the data being sent.

  1. Set up the communication channel in your React component using the unityContext.on() method:
unityContext.on('MessageFromUnity', (message) => {
  if (message.method === 'myReactMethod') {
    const parameter = message.parameter;
    myReactMethod(parameter);
  }
});

In the above code, unityContext.on() listens for messages coming from Unity. When a message is received, it checks if the method property matches the desired method name ("myReactMethod" in this case). If it matches, the parameter property of the message is extracted and passed to the corresponding React method (myReactMethod() in this case).

By using the SendMessage function in Unity and setting up the communication channel with the unityContext.on() method in React, you can call methods in your React component from Unity and pass data between the two environments.

Remember to replace "myReactMethod" with the actual name of your method and "Hello from Unity!" with the data you want to send.

#
  • I found this by asking to gpt, doest is sound right? most of the other replies about the topic werent that much....
random talon
high patrol
#

Yep! looks like you've got pretty much most of what you need to get unity to talk to your js/react component

#

The websocket link I shared is just a library I used before to kinda show the layout of how unity can talk to javascript code

#

you don't need to use any of that unless you're trying to make a websocket

random talon
#

I just need to send a string

#

So does the guide I posted could potentially work? In that case it basically need to be set from react and I'll just do a normal SendMessage call with that method name

high patrol
#

Yeah it should work

empty jacinth
#

Can anyone help me. I am having an error when building my project in webgl

chilly gyro
#

is there a preferred way to run webgl games on a local server? or a free server people like to use?

sweet oriole
#

Some probably test their WebGL builds with their Node.js website development setup.

chilly gyro
random talon
#

If have a strange issue on webgl regarding audioclips:
I request an audio from an api through a WebRequest, I even receive it and im able to play it in an audiosource BUT when running on webgl if I try to debug.log its lenght I always get 0 while on editor the value is correct

random talon
#

at least 5 years ago this issue was tagged as "will not be fixed" ๐Ÿ˜

random talon
#

Please if somebody knows how to solve this issue let me know.

sweet oriole
#

Could try submitting another bug report to get a second opinion

astral wave
random talon
random talon
random talon
#

Ok I reported it trough the Unity Hub app, hope it will be noticed

orchid bridge
#

Hey all! Today, I tried exporting a Windows Game I made yesterday into WebGL for itch.io web support but Unity didn't let me export the build and gave me this error. I don't understand what it's saying, any help?

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <dc14d30a5e0540ee9311ed6df63d9074>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <dc14d30a5e0540ee9311ed6df63d9074>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
sweet oriole
sweet oriole
orchid bridge
#

I found this line, it looks like it could be the issue? Freezing tundra.dag.json into .dag (.dag file didn't exist)

#

Probably not though, I'll keep looking around

sweet oriole
#

@orchid bridge Yea it's not guaranteed that you'll find anything. Next I would probably try building an empty project to make sure the build environment works.

orchid bridge
#

Alright, well thanks anyways!

#

I redid the data saving and that fixed it!

ashen matrix
#

Does anybody know why i get these Error trying to built my project?
Unity 2021.3.15

outer rampart
fierce ingot
#

Does the Audio Low Pas Filter not work in webGL? Works okay in the editor.

#

I did a nice job setting up some audio occlusion only for the webGL build to ignore it.

ashen matrix
outer rampart
ashen matrix
#

i will try XD

rough maple
#

Hi Good Day everyone. Hi I have created multiple games and published in google play. What I'm planning right now is create a web based game like eduten. My first question is does anyone knows what game engine is eduten made of. second question is unity webgl performance same as phaser game engine ? Third question is will unity webgl support browser games in PC and mobile? Thank you

slate stag
#

I'm trying to post my game online, but for some reason, the html version doesn't load cutscenes properly (the cutscenes are mp4 video played through the main camera and on the html version they don't play, it just gets stuck) and also the UI gets all messed up when it's not in fullscreen. How do I fix these issues? I'm not very familiar with how this WebGL stuff works.

sweet oriole
random talon
#

To be clear I could have used a (while != audioclip.state.loaded) with a timeout but I'm afraid that a while loop could impact the performaces in a more significant way

undone loom
#

WebGL is shit

#

There are a lot of errors on it even project works well on PC

weary viper
#

So i've tested by creating builds in unity 2019, 2020, 2021 and 2022 of just a new project with the sample scene, Everything loads fine when i host the builds on itch.io but when i try to host the builds on the server at the company where i work the build just hangs past unity 2019. Unity 2019 and earlier work fine but 2020, 2021 and 2022 get stuck like you see in the screenshot there.

Can anyone think why this might be the case?

weary viper
#

Ah never mind, got it working now. Just needed to update the web.config file

astral wave
# undone loom WebGL is shit

yes you are totally correct ๐Ÿ˜„ tho it teaches something very important, that one needs to know about differences between platforms.

unreal rampart
#

Still didnโ€™t find the solution

#

Someone can help please

sweet oriole
#

Always check the browser console for errors and share them

jagged junco
#

why is this happening?

south onyx
jagged junco
gleaming timber
#

Hi all. I'm in the planning phase of a new project and looking for guidance on repository/project structure. The stack will be a React frontend with Node.js+Koa backend all to serve a Unity WebGL build. I chose this stack specifically because of a potential job opportunity and seeking to build familiarity. It seems like I could just have a single repo with frontend/backend/unity folders, but I'm curious if there's a best method or wisdom that could be shared for a project like this--I don't know what I don't know. Thanks in advance.

#

The alternative I thought of is to separate out the Unity project, and serve the build files from some kind of hosting/cdn. Then develop the React/Node.js+Koa application completely separately

cloud ermine
#

over and over again since 2019 ๐Ÿ˜‚

#

do you solve it ?

undone moth
#

Dang thatโ€™s more than a year ago lol, yeah I did

#

But I have no idea what the issue was or how I solved it

#

I think I contacted my hosting provider with the issue and they changed something on their end, I remember it taking absolutely forever, because the customer service team was middle manning and had no idea what they were talking about

keen urchin
#

I hope you haven't been trying to do only that since 2019

cloud ermine
#

anyway how to treat responsive webgl content in general

#

like multiple virtual smartphone device seems not fit with my sizing

tranquil tree
#

hi friends, Did Unity get rid of the "streaming assets" folder on the web gl build?

#

I am not seeing it when I make a web gl build

#

thank you for any help

outer rampart
#

I'm not fully sure how it works, but I think you can use it if you use WWW (or maybe webrequest) to read the files.
At least this worked in 202lts

worn isle
#

heloo all
why my build size too big

#

where does it come from 30mb

sweet oriole
#

30MB isn't super unreasonable, especially if you can load some of it between main menu and gameplay. Addressables is a pretty easy way to get started with this.

#

There are build size report tools for a more detailed size breakdown

worn isle
#

thx I will search Addressables

random talon
#

is there any reccomended resolution for webgl apps? I noticed that the higher the resolution the worst framerate I get

#

and its a bit frustrating cause even if the whole rest is optimized I still run low fps

cloud ermine
astral wave
# random talon is there any reccomended resolution for webgl apps? I noticed that the higher th...

Yes and no.
No, couz browser window can get any resolution as it is re- scalable and it will adapt to that resolution. As you can setup your quality settings to scale 1/4th of resolution that is requested. There are some ways to workaround it.

If you add mobiles you have even more resolutions and problems.

Yes: if you aim at iOS devices as well, you can target resolution that their view port scale is smaller (390 x 844 for iOS 14 ) that actual resolution of the device, so you could aim at that. Decide minimum device you want it to run and set resolution to that device

#

by the way I also add Ration problem to resolution as well ๐Ÿ˜„

#

Optimizing on webgl is another story tho. Things can run smoothly on pc aka "optimized" does not mean it is optimized for webgl. I can give you example: video streaming on windows use 0.5% cpu usage of the game. On webgl it becomes 75% of cpu ๐Ÿ™‚

random talon
#

luckily is pc only

astral wave
# random talon luckily is pc only

you are lucky then, at least you can connect profiler normally ๐Ÿ™‚ but in general I would in your place set multiple quality levels, with different resolution. Then in order to limit rendering resolution you will need that in html actually, as unity takes that data for scaling on webgl. Or you will need to find where it does that and remake it.

random talon
#

I connected the profiler but noticed the most of the resources are used by "Other" UnityChanThink

astral wave
# random talon I connected the profiler but noticed the most of the resources are used by "Othe...

Well GPU profiling is not available on build version if I remember correctly. Tho they updated profiler in 2023 so it might be old information.
have you also tried Memory profiler? It can give quite interesting information!

In general my rule of thumb is I profile in Editor or Windows build, then results I get divide by 4 and that is expected performance on webgl. Also have in mind multithreading don't exist on webgl and etc.

But for video best would be if you woould sjhare screen shot, link, or at least your settings in your quality options and rendering options.

random talon
#

is there anything I can turn off?

random talon
#

Also I'm having a big issue that can't figuring out how to solve:
Looks like the WebGL app "steals" all the keyboard input so I can't write anything on external forms in the same web page

#

If found this
UnityEngine.WebGLInput.captureAllKeyboardInput = false;but it gives error when playing or building

random talon
#

any idea on why I get this?

compact shuttle
#

hi there, ive been making my very first 2d game for webgl. ive set the background color of my camera to be lightpink but in the webgl build it turns into a dark orangish shade. moreover theres random flickering usually when im moving my mouse around. could you suggest a fix?

random talon
#

About my issue I found this

jade gazelle
#

Can i deploy a unity WebGL in Docker?

compact shuttle
acoustic cosmos
compact shuttle
#

I made a prefab and used instantiate to spawn a pipe at a regular interval and a movement script on every pipe object to move it right to left and then delete when it goes off screen

acoustic cosmos
#

it actually seems pretty inconsistent, but the music definitely only starts playing after the lag. Might be loading the music every time. Do you play the music even when it's muted or still play it just at 0 volume?

compact shuttle
#

Haha i didnt know about the music bug ill try to fix it

#

I have to music on a separate game object... I disable it when the mute is enabled in game

#

Maybe its the wwise sdk... They warned me about it being experimental... The addressables seem to lag my offline builds aswell

acoustic cosmos
#

could be the ambient sounds being loaded or just the sdk in general. It seems like all of the sounds don't start until after the lag spike

compact shuttle
#

Oh yeah the wind loads everytime it plays

#

Is there an alternative to keep the ambient stuff... The event that triggers it lies within the playmode scene so whenever we click play again it stops and repeats

acoustic cosmos
astral wave
# random talon Here's my rendering options

wel it really depends on your game, but for webgl I think you shooting a bit too high. that is really hard to make game look good and smooth on webgl. In your place i would reduce render scale, maybe even disable MSAA, reduce shadows as much as possible. Try using default low profile instead of high, and check if it improves your performance to targeted specs. then increase things to look as good as possible. what fps you are getting in game you running now?

random talon
#

for the rest thanks for the suggestion, I'll change the settings

queen hill
#

Hello! I've been running into an issue where I'm trying to make an API call to my backend for authentication purposes, then set a cookie in the browser. Problem is, I still end up being able to extract the cookies in the Unity editor, but not in the webgl build in the browser. There seems to be a known issue where WebGL where it does not allow headers to be set.

I tried to overwrite the javascript fetch function in the build html script as was done here in this guide https://stackoverflow.com/questions/72404284/unitywebrequest-webgl-missing-cookie-response-header - but with no luck.
I still end up being unable to read the header in the browser.

Has anybody experienced this before or have any idea how to fix this?

arctic rose
#

What exactly do you mean by reading the header? You can't read cookie headers directly, like the SO answer says

random talon
#

Does Linux os has any difficulty building unity webgl apps?
I'm using a line containing "WebGLInput", on my local Windows machine it build normally and the app works but on an AWS container that runs on Linux it fails

astral wave
# random talon Does Linux os has any difficulty building unity webgl apps? I'm using a line con...

Fails to build? I never build it on Linux machine so I am not sure. My guess you are missing some libraries like: Git LFS, or make sure your unity version is the newest, as there were some bugs in older versions (https://issuetracker.unity3d.com/issues/linux-webgl-build-crashes-every-time-when-using-unity-editor-on-linux). Question did you just coppied project to linux from windows system? if yes, then delete project/Libary folder, and let it rebuild it when you next time start unity.

astral wave
acoustic cosmos
#

I have a problem with the video player for WebGL. I got it working fine with no issues on one project, but on another the video just refuses to play. This only seems to be an issue on Firefox, and the video plays just fine on Chrome. The first project loads a video just fine on both Chrome and Firefox. The second project can play the first project's video just fine, but not any other videos (so not a critical problem with the second project's video playing system). The second project also fails to play shorter videos (so size isn't an issue).

It seems like there's some issue with the format of the videos or Firefox's WebGL just refusing to play some types of videos. I've tried building in multiple versions of Unity (2021.3.24f1, 2022.2.12f1, 2023.1.5f1), all of which fail to load the video.

Any insight would be appreciated.

Both projects have the videos after you hit start.
Project 1: https://machasins.itch.io/cornered
Project 2: https://machasins.itch.io/discord-mod-simulator

random talon
#

The thing is it normally works fine, then I added that line of code and suddenly it fails to build

astral wave
#

did you install Editor on linux with webgl platform modules from Unity Hub? I would assume you were using it and not console interfacce. if console interface are you sure while isntalling you told it to install webgl stuff?

random talon
astral wave
#

Your webgl Is non multiplayer right? As I would teest if it builds non webgl builds

random talon
#

no its not multi

random talon
#

oh right

#

It does

#

but that specific line mentioning "WebGLInput" need to be in a #ifWebGL check

#

cause its a library exclusive to that platform

astral wave
#

Sounds very much like Unity bug then. You could try report it to Unity.

As if it is in #IF UNITY_WEBGL and build on linux, that means it does reload and recompiles scripts before building. As you would get errors where you have #if UNITY_SERVER or something like that. I dont even know if you can recompile scripts on code lines :

random talon
astral wave
#

Then most likely it does not have WebGL libraries for some reason. Have you tried reinstalling unity?

random talon
#

not yet

#

but is it possible that it builds a webgl game without these said libraries?

sweet oriole
#

Did you see the last post on the link you posted?

random talon
sweet oriole
#

I believe we have used multiple editor instances to build for each platform. Starting Unity with the target platform might work better?

random talon
#

at this point the only thing I can think to try to solve this is to switch the virtual machine in the container from Linux to Win to see if thats the issue...

#
{
#if !UNITY_EDITOR && UNITY_WEBGL
    WebGLInput.captureAllKeyboardInput = value;
#endif
}```
#

this is the line of code giving issues btw

#

damn it sucks when the issue is so nichey that there are no posts around

random talon
#

also this was the output log on build fail on the AWS container:

1
##### Output
Assets/Scripts/WebManager.cs(203,5): error CS0103: The name 'WebGLInput' does not exist in the current context
*** Tundra build failed (9.53 seconds), 374 items updated, 479 evaluated
## Script Compilation Error for: Csc Library/Bee/artifacts/2000b0aP.dag/Assembly-CSharp.dll (+2 others)
## CmdLine: "/opt/unity/Editor/Data/NetCoreRuntime/dotnet" exec "/opt/unity/Editor/Data/DotNetSdkRoslyn/csc.dll" /nostdlib /noconfig /shared "@Library/Bee/artifacts/2000b0aP.dag/Assembly-CSharp.rsp" "@Library/Bee/artifacts/2000b0aP.dag/Assembly-CSharp.rsp2"
## Output:
Assets/Scripts/WebManager.cs(203,5): error CS0103: The name 'WebGLInput' does not exist in the current context```
#

@astral wave Did you see anything wrong? (sorry for ping)

astral wave
#

I had these errors on windows, when my Visual studio code were missing libraries installed.

#

Could it be specific Linux version that causing problems?

random talon
astral wave
#

it does not generate netcode and others. If your system dont have you will get errors.

random talon
#

So I should try to also import the library then

random talon
#

@astral wave just to keep you updated on the case, this time I've also uploaded the Library folder to the container and so far seems that the build pipeline completed successfully, at this point I guess that Linux has difficulties at creating some specific libraries. Thanks for the suggestion!

orchid bridge
#

can anyone help me with this please ? i got this error and i have no clue why , i got the error while trying to make a webgl build (it solved itself, idk how)

astral wave
random talon
#

Is webgl2 noticeably more resource intensive than webgl1?

cloud ermine
#

is it really adding custom .https will get rid this notification ?

astral wave
# random talon Is webgl2 noticeably more resource intensive than webgl1?

from what I understood Webgl2 is just superior in everything over webgl1. It just webgl 2 support more features than webgl 1. if you dont use those features it will perform not worse than webgl 1.

Plus new unity versions officially DO NOT support webgl1 anymore
From Unity 2022.1, the Auto Graphics API setting no longer includes WebGL 1 Graphics API.
You can manually add it back, but with your own risk.

astral wave
random talon
#

I randomly discovered WebGPU few days ago, I hope Unity will implement it soon since it seems fixing the big graphical limitations that webgl has

sweet oriole
random talon
#

It should be, I read about a unity dev saying time ago it was planned for 2023.2 experimental but I guess it got pushed further away

cloud ermine
cloud ermine
sweet oriole
queen marsh
#

how do I solve this issue

queen marsh
#

okay so finally after like 10 hours I managed to solve this issue
if anyone gets the same issue next time, basically you want to enable name files as hashes

weary viper
#

I have a webGL build with Input fields (UI Toolkit input fields) but the problem is that when i run the build on mobile i can't type, the mobile keypad does not pop up, what can i do about this?

#

Is there like some kind of internal unity code i can call to have the mobile keypad pop up?

astral wave
# weary viper I have a webGL build with Input fields (UI Toolkit input fields) but the problem...

almost everyone I know just uses this:
https://github.com/kou-yeung/WebGLInput

From what I understood unity supports keyboard only on mobile build, but webgl build is not considered Mobile so thats why. Maybe someday it will work by default, someday.....

GitHub

IME for Unity WebGL. Contribute to kou-yeung/WebGLInput development by creating an account on GitHub.

sweet oriole
random talon
#

When sending a webrequest, what's the difference between using a yield return null and an async request to wait for a response?
Is one of the 2 approaches better in terms of performances?

astral wave
# random talon When sending a webrequest, what's the difference between using a yield return nu...
  1. On webgl you will get same performance regardless, as you have only main thread anyways.

  2. Async give you higher control, from letting you return values or pass interuption tokens in cancel webrequests and etc.

  3. While async works, but most threading features does not work on webgl. So you will find weird behaviors like something not working without errors and etc. Unless you use UniTask (https://github.com/Cysharp/UniTask) which lets you enjoy all tasks features and queues of tasks and etc.

So in short, you will get no performance gain and webrequests if you download any textures or something bigger HUGE part of CPU. You will get no multithreading anyways. But I personally like Async way more, with hope someday native Tasks and multithreading will be available and I wont need to rewrite most of the code.

#

There are tons of forums about Coroutines VS Async, in general Coroutines have less overhead, but that difference is not that huge. So if you need something to Run and forget, use coroutines. If you need something returned? like did request suceeded and etc, then async functions more helpfull.

#

sorry that I put more than async vs yeld. But with webrequest you will most likely will need a bit more than just that.

random talon
high patrol
#

I think with unitask lets you return stuff, it's really handy overall and pretty easy to use once you get the hang of it

ashen ice
#

Could it be that itch.io webgl is limited?

#

everytime i try to spawn in it crashes with a error

#

Pls dm or tag me if you can help me

sweet oriole
ashen ice
#

Didnt try

#

i will try later

astral wave
tired cobalt
#

what's the difference between PWA and minimal
I'm having the game hosted on itch.io

limber cave
#

Idk tho

#

Never used web gl

orchid bridge
#

Try https://ev.io, it's a good example. You should see a pop-up prompting if you want to install on your desktop.

random talon
orchid bridge
# random talon It still runs on broswer to me, no pop-up appeared

ah OK, maybe they don't have the prompt enabled. Try this if you are on Chrome: Top right look for this Install icon, that should do it. Once you see the icon on your desktop. Try closing your browser windows and launch it from the desktop. You should see all the Browser navigation stuff removed and only just a dedicated window for the game. (P.S. it's still technically running in the browser in this new PWA window, just it's modified to look like a navtive desktop application)

#

I'm personally really excited for what PWA means for the future of web gaming + WebGPU. I think we are going to see more high quality games hitting the browser platform in the very near future.

random talon
orchid bridge
# random talon since its "installed" does it have more resources to work with and so better per...

I know that with PWA when it comes to Web Application, it gives developers the ability to cache more data I think and implement offline features. So technically the app could work offline, commit changes like "post a message into queue" and when the app comes back online the message will automatically submit. Stuff like that... I don't think we are going to see a huge performance boost for Web Games until WebGPU is supported. I think PWA can help with performance a-bit with the cache features I mentioned and something known as service workers. But you'd have to dive deeper into that to figure out how to benefit from it for your particular game.

orchid bridge
#

It would be nice is Unity added more details on how to take advantage of Service Workers, and how PWA would benefit a web game. Like the example I provided above, it's a nice feature to add to your Web Game. Having the option for players to install it on their desktop.

random talon
#

Ok thanks for the info

#

Then I'll keep praying for WebGPU arrival since now the only things that bothers me about WebGL are performance issues

orchid bridge
# random talon Ok thanks for the info

I hear a-lot of people complain about WebGL performance issues, but when I see a game like https://bapbap.gg we have to ask how much of the performance issues we complain about is simply a matter of being lazy and not optimizing our game very well ๐Ÿ˜…

Free-to-Play MOBA Battle Royale game in your browser.

#

If you tried developing for WebGL a few years ago, I'd totally validate those complaints as it was truly a struggle then. Today it's gotten soo much better. I'm currently pushing 32-48 players in a multiplayer game on WebGL using Mirror Networking and low-poly style, with tons of messages, and special fx, sound fx, all being played back at the same time with pretty good performance. I'd be happy to show some live performance stats with my project maybe in a few days.

#

Of-course if you are trying to create a game that has a lot of heavy textures, and high poly counts, you'll for sure have an issue. In these cases I totally understand the complaint. Although I would have to ask, what's more important "Fancy Graphics" or "Quality Gameplay" if you say both, then WebGL or maybe even WebGPU may not be the platform for you. Mobile & PC is probably more your platform if you want less technical limitations.

random talon
#

For sure there's always something to optimize but In my case the scene its pretty simple and mostly static with a couple of script running in background, maybe the polycount is a bit high but the main issue is mostly on low end pcs. I heard the the general webgl rule is "look the FPS you get in editor and divide them by 4" and I kinda agree

orchid bridge
random talon
orchid bridge
#

this is an awesome device specs report by Poki.com that shows you specs based off of 50 Million Users on their game portal site. Based on this report about 80% of users have CPUs with 4+ cores which I think means at least 2GB - 4GB of Ram at minimum. Which is a a minimum requirement for WebGL games to run. So as long as your game is optimized to run on 4 Core CPUs and 2GB - 4GB of ram you should be good!

orchid bridge
# random talon I guess 300โ‚ฌ laptops

Hmmm what is that like a really cheap netbook / Chromebook or something. The above report shows only 6% are running Chomebook OS. Which means not many people are playing WebGL games on such low end devices.
Also for that low of a price, I don't think a laptop comes equipped with a decent graphics card to even run WebGL properly. You may be over thinking it, and trying to target such low-end devices with a userbase that is almost non-existant for WebGL games.

orchid bridge
#

although I can totally see the chicken or the egg problem here... if no WebGL games are available that run on such low end devices then yes, obviously the current market share is lower. I think it's easier to work with and build for the existing known market share vs trying to establish a brand new market of players though.

random talon
#

I agree but currently im developing an edutainment app that corporates provides to its employees, it must be on WebGL since its basically a front-end where all the logic part is handled by the site itself

#

And since 90% of these users are boomers they will have a bare minimum pc

orchid bridge
#

@random talon You may want to try Three.js then... https://Hordes.io is the only browser MMO built on a custom version of Three.js that can handle hundreds of concurrent connections within the same scene with OK performance. Otherwise with less concurrency in a scene the performance skyrockets probably out-performs Unity WebGL by a ton!

I don't know of any good benchmarks to show the difference but I know when I try to push my current multiplayer game concurrency close to 60 - 100 players performance is horrible. So I can only push 32-48 comfortably at this moment.

It's a tradeoff i'm willing to live with for now because productivity is much higher and I can get things done faster in Unity in comparison to working with a JavaScript Library that you have build almost everything from scratch.

random talon
#

The app is singleplayer so I have no issue on the multiplayer side

orchid bridge
# random talon The app is singleplayer so I have no issue on the multiplayer side

in this case you really should have have no problem optimizing the crap out of it to run on lower end PCs as long as you keep polys low, and minimal textures. In my project, I only use 1 Texture and 1 Material that has a palette of colors which is then mapped to all objects in my game. So this results in 1 draw call. If you are already doing this awesome! If you still see performance issues I think you'll have to really optimize the code then, using Unity Profiler should be a good tool to find spikes in performance on code running.

#

If none of this works, and your $300 laptops are running your single player WebGL game with crappy performance shooot!! Yea, you may be out of luck and may have to try alternative WebGL game engine / library.

charred briar
#

Yeah as mentioned it should run fine on that if optimized well (we do a ton of edu sims for VR and web). But yeah, in lots of cases playcanvas or threes.js or Babylon or some raw webgl library is always a more performant way to go.

We've had to do some dark magic with unity webgl for low end devices before, including manipulating and pausing rendering.

echo cloud
#

Was anyone able to run URP in WebGL. Not sure where to write, but I tried to create a URP project from the template, switched to WebGL and tried to run it, but I'm getting errors. It runs if it's a Release build, but not a development one

astral wave
astral wave
echo cloud
rugged hinge
#

is netcode for game object support webgl build

tropic patrol
#

hello I'm experiencing issues regarding 3d audio blend on webgl builds in 2022.3.4f1 and 2022.3.7f1, it is simply not working.
https://issuetracker.unity3d.com/issues/on-webgl-player-spatial-audio-3d-sound-settings-does-not-change-direction-from-where-the-sound-is-played this bug is supposed to be fixed according to the issuetracker
works fine in editor on windows/windows build

orchid bridge
tropic patrol
#

do you mind telling me what version you are currently using?

astral wave
astral wave
echo cloud
astral wave
echo cloud
# astral wave without error can't help anything. It builds without problems for me. so thats w...

I understand. Here is properly submitted bug:
Steps to reproduce:

  1. Create Project (3D URP)
  2. Switch platform to WebGL
  3. Check Development Build (without this step it's working fine)
  4. Build and run

Expected result: See the application in the browser

Actual result: Error: (Sorry for the screenshot, for some reason it doesn't let me copy the string from the message). I have 64 GB memory and around 20 is free now

echo cloud
# astral wave without error can't help anything. It builds without problems for me. so thats w...

Stack trace: Uncaught RuntimeError: memory access out of bounds
at UniversalRenderPipeline_SetupPerFrameShaderConstants_m9CE3FEB386B87C56438021D38AF3ACF7936293A9 (Temp.wasm:0x7eaf93)
at dynCall_vi (Temp.wasm:0x1e2d30a)
at Temp.framework.js:1796:22
at invoke_vi (Temp.framework.js:16638:5)
at UniversalRenderPipeline_Render_m15A42AB44C14AB4DCA7EF0B915964D46B643D50E (Temp.wasm:0x7e9508)
at RenderPipeline_InternalRender_mCB77395158F4572F348D8227BA9127ABF1C9C5BE (Temp.wasm:0x31a492)
at RenderPipelineManager_DoRenderLoop_Internal_mB646C8738F4A9859101F3BE94809E2E10BBDB1FB (Temp.wasm:0x31b8e4)
at RuntimeInvoker_FalseVoid_t4861ACF8F4594C3437BB48B6E56783494B843915_RuntimeObject_IntPtr_t_RuntimeObject(void ()(), MethodInfo const, void*, void**, void*) (Temp.wasm:0x131268f)
at il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**) (Temp.wasm:0x1358922)
at dynCall_iiii (Temp.wasm:0x1e2d2f8)
at Temp.framework.js:1796:22
at invoke_iiii (Temp.framework.js:16649:12)
at il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) (Temp.wasm:0x1354a12)
at il2cpp_runtime_invoke (Temp.wasm:0x135a481)
at scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) (Temp.wasm:0x1dd5d61)
at ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) (Temp.wasm:0x1d7432c)
at ScriptableRenderContext::ExtractAndExecuteRenderPipeline(dynamic_array<Camera*, 0ul> const&, void ()(SceneNode const, AABB const*, IndexList&, SceneCullingParameters const*), void*, ScriptingObjectPtr) (Temp.wasm:0x15555ba)

astral wave
#

this error is quite not readable. It is way better to press f12, open browser debug console and then press ok. It will write all code there.

#

Stack trace: Uncaught RuntimeError: memory access out of bounds hmmmmmmmmmmmmmmmmm

#

what is your maximum memory set on player settings?

echo cloud
echo cloud
astral wave
#

hmmmm, have you tried deleting library folder yet?

echo cloud
astral wave
#

it might failed build webgl Libraries when you switched platforms.

echo cloud
echo cloud
#

@astral wave : One more question: If I start the webGL app before the canvas is displayed it throws error ([.WebGL-00001B017D343100] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment has zero size.) . That only happens when I run it with URP, It didn't happen before. And if I keep the app on the screen it doesn't show. The reason I don't want it display, as there are some addrassables that takes time to load and it doesn't look good

astral wave
# echo cloud <@821626071853694987> : One more question: If I start the webGL app before the c...

There is several approaches. You can handle this on JS and html side. But most likely for that you will need to hide canvas without changing its size (resolution), as unity needs that info to create loading. You can then create event that on Addressables done loading you call JS and show the Canvas.

I personally went with more stupid brains way. Create Initialization scene, which have "fake loading screen image", and load all addressables things then. And when done I change I unload that scene and forget about it.

orchid bridge
unborn girder
#

How do I make this work?

tropic patrol
# orchid bridge 2021.3.7f1 LTS

just tried this version as well, not working either... am I the only one on this planet using spatial blend on webgl ? ๐Ÿ˜“

orchid bridge
#

reading alittle on what Spatial Blending is morph between the two modes of 2D an 3D sound I guess you are doing something different than what i'm mentioning above. In this case, shoot sorry have no idea about this sort of thing ๐Ÿ˜…

#

I guess in my case i'm only using 3D Sound, and you are trying to blend between the 2 modes. I guess maybe ask yourself if blending is really necessary for your game?

#

3D sound varies based on distance, 2D is constant no matter the distance of listener. I would think we all want 3D sound for 3D Games no?

tropic patrol
# orchid bridge are you trying to hear sound based on the distance... so the closer you get the ...

I figured out after 2 horrible days of debugging ๐Ÿ˜“ when using a video player and outputting the audio to a audio source (the only way to use 3d audio of a video player, using only ui at least) effects like spatial blend won't work. https://forum.unity.com/threads/webgl-spatial-audio-for-videoplayer.947112/

#

according to employees that have replied to the thread it is not a bug but a technical limitation that was supposed to be looked into in aug 2020 but no updates since then

Hi again!

The limitation of audio mp3 streaming seems to be one imposed by Unity, not by the browsers, possibly coming from an era where this wasn't broadly supported (just guessing here...). We'll test it out and remove this restriction if everything works out. It's been pointed out earlier: https://issuetracker.unity3d.com/is...le-in-editor-with-build-platform-set-to-webgl so it's already in the todo.

Looking at the current code, .wav may work but streaming of uncompressed audio is not a very exciting solution.

So for the time being having a built-in audio asset (not streamed) and a video stream seems to be the other compromise that's available to you.

Sorry for all the trouble... Hope you find a way to your goal; let us know how this goes and we'll see if there's anything we can think of that can help.

Dominique ```
#

there could be a warning about this because some people like me are stubborn and spend hours and hours trying ๐Ÿ˜“

orchid bridge
tropic patrol
#

will take a chill pill for today and see which alternatives I have tomorrow salute

#

I'll open a issue on the bugtracker

nocturne timber
#

hi

#

i have been trying to send email through webgl but nothing seems to work

#

can someone please help me

#

i made a application that detects face and u can change glasses , i was taking screenshot and sending that through email it was working fine, but when it ried webgl it doesnt work :((((((((((

tropic patrol
nocturne timber
#

Thanks

orchid bridge
orchid bridge
# nocturne timber i made a application that detects face and u can change glasses , i was taking s...

I would personally use something like NodeMailer https://nodemailer.com/about/ and Cloudflare Workers https://developers.cloudflare.com/workers/ or Firebase Cloud Functions https://firebase.google.com/docs/functions to handle this.

Cloudflare Workers provides a serverless execution environment that allows you to create new applications or augment existing ones without configuring โ€ฆ

nocturne timber
#

thanks man

#

i will try this

astral wave
#

Dear friends, what would you suggest for cloth physics on webgl?

  1. just generic unity cloth?
  2. fake bones for cloth and just mesh deformation?
  3. any asset you know that works well?
  4. any other ides?
orchid bridge
# astral wave Dear friends, what would you suggest for cloth physics on webgl? 1) just generic...

@sweet oriole suggested Flexi-Motion to me a few months ago. I'm pretty happy with it. I was previously using Dynamic Bone. Flexi-Motion definitely performs much better and provides much better physics simulation in comparison to Dynamic Bone. https://kybernetik.com.au/flexi-motion/

Unfortunately Unity Cloth is not supported on WebGL, so using an asset like this for now is our only option I think until maybe WebGPU is supported. I think WebGPU will give us cloth physics support and much more i'm pretty sure.

astral wave
orchid bridge
nocturne timber
#

hi guys

#

I cant create my webgl build anymore
it was creating the build perfectly 2 days ago but since yesterday i can't

#

it creates build for other platforms just fi e

#

fine

#

ill share the errors i get upon build fail

#

please help me or if someone can guide me to fix the issue

nocturne timber
#
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <a53e7cd0bf8c4035ac3e78fb7b43c4a6>: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 <a53e7cd0bf8c4035ac3e78fb7b43c4a6>: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 <a53e7cd0bf8c4035ac3e78fb7b43c4a6>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)


UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <a53e7cd0bf8c4035ac3e78fb7b43c4a6>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <a53e7cd0bf8c4035ac3e78fb7b43c4a6>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
charred briar
orchid bridge
# nocturne timber please help me or if someone can guide me to fix the issue

I usually have to do a full restart of my Laptop, and make sure not to launch any other applications except for Unity to have successful WebGL Build. This is mostly because WebGL build process uses a crap ton of memory. So if I have a-lot of apps open, I can't properly build until I free up enough memory. I have friggin 16GB of Ram and still my WebGL Builds give me issue due to not enough memory. Not sure if that's your issue here but try to do a clean reboot, and only launch Unity and try to build.

nocturne timber
#

thats so annoying

#

okay let me try this real quick

nocturne timber
#

earlier the build was taking around 10 to 20ish minutes and now it took like 1minute

#

but still it failed

#

it has 6 errors

orchid bridge
nocturne timber
#

could it be because I changed the index.html file of my previous build ,
I added some buttons to it using html and javascript to manipulate stuff in unity using those buttons instead of unity buttons

#

but i removed that bit of code from it

#

so i should delete the build?

orchid bridge
#

no any changes to index.html file won't affect your WebGL build as that is totally seperate thing. Unity just happens to provide you with a template index.html along with some basic styles.css. So if you made some changes to that, you may want to copy all of that to a separate folder. Delete your orginal build folder and try again.

nocturne timber
#

so lik delete the build folder in general

#

and create a new build

orchid bridge
#

1 min

nocturne timber
#

okay

orchid bridge
#

so my build folder is on my left... if I made changes to the Index.html and any of the data residing in TemplateData copy or move that into a new folder to save that!! Otherwise if you re-build you'll lose those changes

#

So after you move / saved your index.html and TemplateData to new folder. Go ahead and delete the Build folder before re-building

#

the after re-build if successful, you'll copy your build folder into your new folder that stores your index.html + TemplateData (in my case in the folder i called Index)

#

then test the WebGL Build from there

nocturne timber
#

okay

#

thanks I'll try this

#

i have these folders here

#

i have a photos folder because my application takes screenmshots and saves them there

orchid bridge
#

cool! this is where you are serving your WebGL Game / App from with your Local Web Server

nocturne timber
#

so ill be moving index.html, streaming assets?

orchid bridge
#

hmmm is your Unity builds set to build directly to this folder WebApp

#

I would just build it somewhere else, then after build is complete copy your Build over here (overwrite your Build folder here)

nocturne timber
#

omg

#

it completed

#

i deleted the whole folder

#

and built in a new one

#

let me try it real quick

#

its not going any further than this

#

but atleast it created a build

orchid bridge
#

hmmm that is certainly an odd looking game lol

#

but yea, cool progress!

#

check your browser console for errors

#

if no errors then maybe you screwed up your CSS lol

#

if you modified the index.html that the Unity WebGL build provided you with, keep in mind there is some style.css and other elements that it may be calling in TemplateData so if you didn't properly migrate that over then could be why your build is not loading.

nocturne timber
#

no no

#

the game is basically a face trackign app with option to change glasses and send email

nocturne timber
#

i made the build again with build and run
it asled for camera access but then its back to this page

#

the title of the app isn't even this
so its probably not loading anything

#

?

orchid bridge
#

sounds like you have a unique app you are building here with needing camera access and such. I've never worked with Unity WebGL for apps, just for games. So i'm not sure.

nocturne timber
#

i found one solution on unity thread

#

forum

orchid bridge
#

check your browser error logs and try searching that

nocturne timber
#

trying it

orchid bridge
#

cool!

charred briar
# nocturne timber

You need to run it on an actual web server, but if you hti F12 and open the console it should show you what is happening.

For WebAR, I don't use Unity, as it just adds a heavy intermediate layer.

#

And depending what you are using, most Unity AR frameworks won't work on WebGL.

nocturne timber
#

okay

#

ill give it a go

#

its giving error in index.html

#

i deleted all old builds and building in a new folder

orchid bridge
# nocturne timber

As mentioned... you are missing TemplateData. Error is referencing Unity Loader which is some elements residing in TemplateData you need to properly migrate over into your webserver.

nocturne timber
#

can you kindly guide me how can I do that? :/

orchid bridge
#

You modified the original index.html that Unity provided right???

#

Then moved that over to your web server.

#

But you never moved the TemplateData over

nocturne timber
orchid bridge
#

When you complete your Unity WebGL Build what does the final build look like???

nocturne timber
orchid bridge
#

I mean within the folder that you picked to build to, what does that look like?

nocturne timber
#

like this

orchid bridge
#

Hmmm I've never seen that setup before. In my builds I always have TemplateData

nocturne timber
#

should i do development build

orchid bridge
#

i'm using Unity 2021.3 LTS though so I don't know if you are using latest version of Unity and what bugs that might have ๐Ÿ˜…

nocturne timber
#

im using the same

orchid bridge
nocturne timber
orchid bridge
nocturne timber
orchid bridge
#

Player Settings sorry?

#

what Template

#

I have always used Default, and it should output a TemplateData

nocturne timber
#

what should I show you from Player settings

orchid bridge
#

which template data are you using?

#

also do you really need streaming assets? I believe this is a setting somewhere, but try disabling that just in case for testing.

nocturne timber
#

ok

orchid bridge
#

Try Default Template with Streaming Assets Disabled. Make sure the templateData is there then move all that to your webserver and see if loads then.

nocturne timber
#

okay

winged island
#

Is here a good place to talk about apache errors when loading webgl?

orchid bridge
# winged island Is here a good place to talk about apache errors when loading webgl?

I imagine you are trying self-host. Have you considered maybe Cloudflare, Netlify, or other CDN hosting solutions for static content (a.k.a WebGL Builds and related website content). It makes life so much easier than fiddling around with VPS, SSL Certs, and Web Servers. Especially if you want your game to scale properly. Self-hosting is really not very sustainable in the long term especially as a indie dev.

charred briar
#

We self host (some our own bare metal) and have about a dozen servers - :). It's nice having next to nothing in server fees.

That said for just flat web servers, there are some great deals (I.e. stablehost @ 30/yr unlimited domains with softaculous). And places like itch.io.

I'd be interested to see the error @winged island might just be a mimetype issue or something easy to fix (I suspect you might not be self hosting but seeing the gzip issue, etc). I do agree though, early on especially, you probably don't want to learn server devops ๐Ÿ™‚

orchid bridge
charred briar
#

I'm pretty sure I'm the only one who would find the topic interesting though:)

orchid bridge
# charred briar Electric is negligible compared to AWS or Azure :). We've been bare metal sinc...

I do enjoy managing my own servers coming from a career in IT and now Full-Time Web Developer. But ya, as a solo game dev (by night) I need to offload some that work elsewhere. So I don't mind paying for it. I would never use AWS, Azure, or even GCP though lol! Wayyyy to expensive. Linode just recently dropped their bandwidth pricing to 0.01/GB... one of the lowest on the market maybe competing with Digital Ocean. I'm actually using Linode to host my Lobby Servers in certan regions, and then using https://edgegap.com for automated scaling game servers.

charred briar
#

Linode and DO are both awesome providers ๐Ÿ‘

#

Although I also prefer linode. DO has changed a lot over the years...

orchid bridge
#

DO performance is lacking at least for Game Servers (based on some research I did), they are still pretty new to that market (perfectly fine for Web Apps though). Linode one of the reason I was sold on them is because they are now aquired by Akamai and one of my favorte games WarFrame uses them for hosting. So if they can handle Warframe MMO for 10+ years, I can count on them to keep my indie game dev severs online lol!

orchid bridge
# charred briar I'll check out edgegap.com - thanks for sharing

I was considering to build out my own auto-scaling game server solution on Linode with Kubernetes but after consulting with Edgegap, they were able to beat the hosting cost i'd be paying with Linode. On top of saving me the headache and time of building out my own solution.

winged island
#

Actually i was using irzcle free resources, but iโ€™ve fixed the error. I just uploaded an uncompressed build to the server and apache took care of the compression, that seemed to f#do the job

orchid bridge
nocturne timber
#

hey i fixed everything

#

its making build now and running things

#

but I want to try manipulating this html file that is made with the webgl build

nocturne timber
#

i figured it out

#

now i can control webgl with javascript and html

nocturne timber
#

I've tried everything (I can send email from webgl), but I couldn't find a way to send attachments in my webgl build, can someone pleasehelp me out with this?

orchid bridge
# nocturne timber I've tried everything (I can send email from webgl), but I couldn't find a way t...

Do you already have a way to send emails first? Do you have an API or Webhook you are hitting to trigger the sending of an email?

If so, the attachment is actually going to happen at the backend. You just need to figure out how to send the data you want to attach to the Email Sender API / Webhook and then handle the attachment there.

If you built your own email webhook then you'll need to add additional code for to handle this there, otherwise if you're using a known Email Sender API Service then they should have some methods for you to hook into, check their API documentation.

nocturne timber
#

I can send the emaul without attachment but with attachment it gives error and ruins the project

#

The app

#

Im sending it through a javascript library

#

I tried asding attachment in that library but it causes the error and doesnt work

orchid bridge
#

Ah gotcha! Yea, then in this case this becomes a JavaScript Library / Module issue you'll need to consult with the creator of that to assist you.

#

it would be outside the scope of this channel for that level of support possibly.

One thing I could say is just be 100% sure that the way you are sending the data is in the correct format that the library wants. As there are many ways to send data. Which can cause errors in uploading, downloading files if not formatted properly.

nocturne timber
#

Can I show you?

#

That library gothub says it cant send attachments:(((
Thats what I want

#

There should be a wayyy
Its 2023 ๐Ÿ˜›๐Ÿ˜‚๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ

tall sand
#

HI

#

i have a problem

#

Assets\SelectFace.cs(23,45): error CS0176: Member 'CubeState.autoRotating' cannot be accessed with an instance reference; qualify it with a type name instead

tall sand
#

nvm thx guys!

orchid bridge
# nocturne timber That library gothub says it cant send attachments:((( Thats what I want

OK so this Library is communicating with https://smtpjs.com/ API to send emails. If you scroll to the bottom of this website you'll see that it does support attachements. But you will need to extend the code of this unity-webgl-email library to support sending attachments. For whatever reason the developers did not add it lol. So you'll have to add this yourself.

nocturne timber
#

Oh

#

Ill try this in morning in the office

#

Can you guide me a bit how I can achieve this

#

I will write a article once I achieve attachment email with unity webgl

#

So other people can fogure it out easily

orchid bridge
# nocturne timber Oh

keep in mind this Library is 5 years old, and the smtpjs.com maybe could stop working one day... as it says it's free to use. But nothing ever free forever lol! So expect it to one day stop working ๐Ÿ˜…

nocturne timber
#

Omg

#

Atleast it will work for now

#

I wont be working for this compnay in 5 years xd

#

Though Ill keep looking for good alternatives

orchid bridge
#

lol

nocturne timber
#

๐Ÿ˜›

orchid bridge
nocturne timber
#

Oh, what are you making?

orchid bridge
#

i have day job, then work on my game in my limited free time.

nocturne timber
#

Oh

#

I used to do that too, but I got scammed and sold my laptop

orchid bridge
nocturne timber
#

Now im recovering myself hehe

#

Great

nocturne timber
#

it doesnt work

orchid bridge
nocturne timber
#

I created a server and sent message (texture 2d, and email as string to it)

#

It worked

#

Now I have one thing
My manager gave me a html file with buttons
Hes saying to atart my unity app with that html (whenever u press a button it will open my webgl and trigger some functiom in my webgl)

#

Is it possible?

sweet oriole
#

It should be standard HTML5 stuff up to the point you boot up Unity and interact with it

nocturne timber
#

Can you give me some tops

#

Tips

#

Please

high patrol
#

wait 30 minutes after eating before you swim

#

You can send raw binary through a websocket, and websockets are supported with unity/webgl. You could encode your presented file into binary, send it, and rebuild it on the other end

nocturne timber
#

thanks

random talon
#

Is there a tris/verts count I should aim to for keep a good framerate?
These are the current stats (on editor)

orchid bridge
# random talon Is there a tris/verts count I should aim to for keep a good framerate? These are...

I'm personally not sure what number of tris/verts you'd want to stay under to keep the best performance in WebGL, but I can tell you that paying close attention to the SetPass calls (which is also known as Drawcalls) is one of the most important things. More drawcalls = lower framerates for sure. One way to keep them down is make sure you are using the least amount of Materials, Textures, and Shadows as possible. As every one of theses counts against you. If you project can get away with no Shadows, perfect! That is in instant boost right there. If you need shadows, then you need to optimize your light sources and amount of objects that need to cast shadows. As I believe every shadow drawn counts as draw call. Finally on the topic of Materials and Textures. If you can manage to create 1 Texture that is Texture Mapped to all objects in your project that that would greatly reduce the number of draw calls. So if you have 10 Meshes that are all using the same Texture this will count at 1 Drawcall vs 10 Drawcalls. Hope this is helpful ๐Ÿ™‚

#

Ah also forgot to mention mesh combining. Let's say 1 of your gameobjects that is a Skinned Mesh consists of 5 separate meshes (usually this is an animating character), that will also count against you. Each mesh = 1 draw call. So if you can combine the mesh into 1, that means 1 draw call vs 5.

random talon
#

ok thanks for the suggestions

sweet oriole
#

Use project showcase channels.

fervent delta
random talon
winged island
#

Hi, i'm making a web app, and I want users to be able to create accounts on mobile, this implies typing in a textfield, but it doesn't work. HideMobileInput is unchecked, my canvas is configured properly, I tried on different browsers (chrome, firefox and safari), and it still doesn't want to open the keyboard. Would you know what's happening?

orchid bridge
tranquil tree
#

hello friends, My webgl builds are not including a "streaming assets" folder. Does this happen to anyone else since updating to 2022.3.2?

#

thank you

winged island
#

It won't let me type in full screen

#

and that's the browser i'm aiming at

astral wave
astral wave
nocturne timber
#

hiiii

#

can someone guide and help me on sending message through udp

#

in unity webgl

#

im sending message to a motor through arduino (in unity it works fine)
but in webgl it throws exception and doesnt wrork

hallow sequoia
#

@nocturne timber You might be running into the browser sandbox, which basically says that a browser can't interact with the host's filesystem. The unity editor is a desktop application and isn't sandboxed.

Talk to me more about how you have your project set up. Is your unity editor talking directly to your arduino, or is there an intermediary server that's handling the interaction?

nocturne timber
#

its talking directly to arduino through arduino ip and port

#
using UnityEngine;
using UnityEngine.Video;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading;
using System;
using System.Collections;
using Sirilix.WatchoutController;
using Newtonsoft.Json;
using System.Collections.Generic;
using TMPro;
using System.Drawing;
using System.IO;

public class UDPListener : MonoBehaviour
{
    // Listening port number
    private const int listenPort = 5052;

    // Listener variables
    private UdpClient listener;
    private IPEndPoint groupEP;
    string targetIPAddress = "192.168.1.101";
    int targetPort = 8888;
   

    public void Start()
    {
        // Initialization of listeners and thread starting
        listener = new UdpClient(listenPort);
        groupEP = new IPEndPoint(IPAddress.Any, listenPort);
        Thread thread = new Thread(StartListener);
        thread.Start();
        //SendUDPMessage("ZERO,1");

    }


    private void StartListener()
    {
        try
        {
            while (true)
            {
                byte[] bytes = listener.Receive(ref groupEP);
                string receiveData = Encoding.ASCII.GetString(bytes, 0, bytes.Length);

                Debug.Log("Received message: " + receiveData);
            }
        }
        catch (SocketException e)
        {
            Debug.LogError("SocketException: " + e.Message);
        }
        finally
        {
            listener.Close();
        }
    }

    public void SendUDPMessage(string message)
    {
        UdpClient client = new UdpClient();

        try
        {
            byte[] data = Encoding.ASCII.GetBytes(message);
            client.Send(data, data.Length, targetIPAddress, targetPort);
            Debug.Log("SENT" + message);
        }
        catch (Exception e)
        {
            Debug.LogError("Failed to send UDP message: " + e.Message);
        }
        finally
        {
            client.Close();
        }
    }
}```
hallow sequoia
#

What type of arduino is it?

nocturne timber
#

arduino uno

hallow sequoia
#

Did they start putting linux servers in the arduino uno chips? A couple years ago you had to buy a model that was capable of interacting via ethernet. Weird.

Otherwise you talk to arduinos using serial comms

nocturne timber
#

in unity it sends message (motor rotates)

#

in webgl it gives errors

#

I searched about it, webgl doesn't support udp I guess

hallow sequoia
#

That's not true -- websockets use UDP

nocturne timber
#

how can i use websocket

#

with webgl

hallow sequoia
#

C# has a libraries that lets you use websockets... But lets not get ahead of ourselves.

Let me re-read your code. I suspect you're writing to serial not to an IP address/port if you're using an uno.

hallow sequoia
#

I was going to say "your arduino is only accessible in your local network but not the public internet" but then I remembered if your computer you're using to access the webGL page is also on the same network then you'll be able to interact with local network resources.

nocturne timber
ashen matrix
#

We have a project that is going great. We only have a problem with the audio.

Smart phone: check
Smartphone with wired headphones: Check
Smartphone with bluetooth headphones: no sound

Does anyone have any idea why this might be?

high patrol
tranquil tree
tranquil tree
#

I thought that unity just packed everything up and made the folder* "StreamingAssets" during the webgl build

#

Should I change that folder name from "Assets" to "StreamingAssets"?

astral wave
#

do not change Assets to streaming assets.

tranquil tree
#

thank you.

#

last Q

#

Should the "StreamingAssets" folder be inside or outside of the "Assets" folder?

astral wave
#

Another tip, if you will accesing files from streaming assets, please check the link I send as many people ignores this line:
To read streaming Assets on platforms like Android and WebGL , where you cannot access streaming Asset files directly, use UnityWebRequest. For an example, see Application.streamingAssetsPath.

tranquil tree
#

ok thank you

#

I will read it

#

thank you very very much. Have a great evening.

random talon
#

Is there a way to "profile" a website? My unity webapp is running at 180fps when hosted on local browser and on itch.io but on my target website it barely goes at 60 frames, at this point I guess its an issue of the website running to many stuff in the background since it embeds the webapp and also do other stuff in the same page. is it possible or there could be other issues?

winged island
nocturne timber
#

hi

#

everyhing was working fine

#
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bf] in <7105be432fb64891b07085914e6cd5c1>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <7105be432fb64891b07085914e6cd5c1>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr)```
nocturne timber
#

so i removed my udp lisstener script and it built thats so strange

astral wave
nocturne timber
#

yes i know

#

im using a server for that

#

like this

distant abyss
#

Hey I am trying to compress my sprites for a 2d game for webGL and I have reduce max size of image from 2048 to 512 but it show little to no change in build and build report...am I missing something?

nocturne timber
sweet oriole
#

That size isn't referring to file size directly

distant abyss
#

Yes they have(eg one is 1920*1080)...although when I reduce the image to 512 it show size decreased in inspector but not build report

charred briar
ashen matrix
high patrol
#

Oh basing this off an issue I had the other day. We had a some weird issue making a call with our audio channels where a wireless headset had some driver software that caused it to attempt to access an audio channel that didn't exist.

orchid bridge
#

Is it possible to change the full screen button image?
I can try literally replacing the image in the build but I'm worried something might break and I also don't want to have to do that for every webgl build I make for every update

sweet oriole
nocturne timber
#

hi can someone help me out

#

I can't make build anymore ๐Ÿ˜ฆ

astral wave
nocturne timber
#

i fixed it

#

unity webgl doesnt allow netwonsoft.json

#

I removed my netwonsoft.json and just used JsonUtility

#

it built

random talon
#

I'm using the profiler (in editor) and I get a big chunk of resorces on "Other", can somebody help me figure out what that is due to?

astral wave
astral wave
#

it is a bit easier to see things when you select. at least for me as you can sort by usage. But once again, i would ignore other until same result would be on profiler when profiling webgl build.

random talon
#

ok

sweet oriole
random talon
#

Autoconnect Profiler is set to True but its not reaching the editor profiler

nocturne timber
astral wave
# random talon

is this from local host right? It should connect. If it is not local you might need to enable browser to allow stuff over http. Chrome dont like that too much.

#

try running : Build And Run. it almost always works well

sweet oriole
nocturne timber
#

okay thanks

random talon
#

and I remember that few months ago that worked ๐Ÿ˜

random talon
astral wave
random talon
#

ok I'll try thanks

#

it worked

#

here's a part

#

I have no idea on how to read that and what are the important parts, can somebody please help?

random talon
#

This is by using deep profiler, the situation seems really different

winged island
#

i've built my project on 2 different devices, and one works fine. The other stops and shows the error : call_indirect to a null table entry

charred sparrow
#

Hey everyone, I have an empty GameObject that acts as my GameplayManager. At the top I have the following public static GameplayManager Instance { get; private set; }

I use GameplayManager.Instance.[fields] to access certain methods and variables.
However, when a game ends and you restart it doesn't work as variables pickup where it left off the last game. I tried resetting them to their default values when the game ends but listeners and events still break. I also can't seem to destroy the object as it messes up elsewhere (mostly since it is a network object that syncs users).

Does anyone have an idea how I can reset "Instance"? Thanks!

orchid bridge
#

how do you detect if on mobile phone or not?

orchid bridge
#

Application.isMobilePlatform

#

@charred sparrow are you reloading the scene?

charred sparrow
orchid bridge
#

if you reload the scene with SceneManager.LoadScene(0) if would reset everything

charred sparrow
fallen fjord
#

Hey guys, Iโ€™m trying to find the recommended server specs for running a 3d unity webgl build, but I canโ€™t find it anywhere

#

Can someone point me in the right direction?

#

I would greatly appreciate it ๐Ÿ™‚

sweet oriole
#

System requirements for an actual game scale with the content, just like on other platforms.

high patrol
#

If you're just talking about a webserver that provides clients with a webgl build, specs can be low since there's very little cpu usage to serve that up. Best to have fast storage

orchid bridge
#

Digital Ocean has been my go to for a long time, they now have this cool app service. It syncs with your Git Repo and builds your front-end automatically on every push / update. It's free to start and even includes CDN. First paid tier is only $5 https://www.digitalocean.com/pricing/app-platform

#

I'm using Cloudflare today though to serve my WebGL clients. After some research and doing some performance + price + support level comparisons between Cloudflare, Firebase Hosting and Digital Ocean. Cloudflare won for me.

gleaming yew
#

Hi everyone, I am having some issues with our game, using textmeshpro on chrome when you resize the window the tmp text completely dissapears, everything else looks fine so it doesn't seem to be a layouting issue.
I saw some other user reporting this on the unity forum and added the info for our case, does anyone have any idea what this could be? On pc builds this doesn't happen at all.

#

this is the thread with more info, and a video showing the issue

nocturne timber
astral wave
# nocturne timber

maybe you want first do what it says? open console of browser (f12) and see what it says on console.
This error can have multiple reasons. Most common that you run out of memory. More rare similar one is when you try access array element which does not exist

upper igloo
#

anyone encountered this error before when building webgl? apparently my game runs fine pre build but after i build the game, the game does not run

astral wave
upper igloo
random talon
#

I need some help regarding compatibility for webGL

#

I toggled AutoGraphics API but I couldn't run on an old laptop, I tought that was the setting to adapts the graphics to each hardware, is it wrong?

#

Then after that I set manually the graphics to WebGL1 and it worked

#

Now if I include both WebGL 1 and 2 will the software automatically manage that compatibility problem?

astral wave
random talon
#

On older laptop webgl 2 is not supported

#

So I want to make a nerfed version for older laptops

astral wave
random talon
#

yes, fully updated

astral wave
random talon
#

I run it on itch.io and got a warning that couldnt run webgl2.0

astral wave
#

How old of a laptop we are talking about? As webgl2.0 is pretty much browser based... Very weird

#

an dwaht browser you were using?

random talon
#

2013

#

chrome

astral wave
#

https://www.khronos.org/webgl/wiki/Implementations/Firefox

Well it seems on super old ones your drivers might block it.

I personally would throw away webgl 1 users, as amount of them will be super small and because of them all other users will suffer.
But if you insist, then
https://docs.unity3d.com/2021.3/Documentation/Manual/webgl-graphics.html
Automatic Graphics API should automaticly select correct WebGL version, but you need to manually add both in the list.

You can check SystemInfo.graphicsDeviceType to console out what support the latpot have to make sure it select correectly.

random talon
#

Got it thanks

random talon
#

I expected the graphics api name

random talon
#

Also SystemInfo.graphicsDeviceName returns "ANGLE (Intel, Intel(R) UHD Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)" so does that mean it doesnt use the gpu? I have a 3070

upper igloo
grim blade
#

hello

ivory shard
#

hey guys how can I host my own webgl game on my own website lol

humble talon
ivory shard
#

nvm I think I figured it out

#

I will try my way rq

#

my idea failed lol

#

Copying the file structure bit by bit is what a pro would do

#

I aint no pro though

ivory shard
#

๐Ÿ™ elp me

#

I will cash app $2 teehee

high patrol
#

there are pretty straightforward tutorials on how to do this using the React-Unity-Component

#

This guy has done a ton of work building this, consider cashapping him a dollar

ivory shard
#

uh this says that its react tutorial

#

and there was only 2 tutorials doing the same 1 method that I cant use lol

#

import React from "react";

#

scratches head

#

Plus I'm kind of using a host website not myself hosting so I can't do it the same either way lol

#

Nothing wrong with using github or replit or something else

ivory shard
#

I got 1 person to help me in 2 hours with $1 incentive it would take forever so I doubled it so in theory it should now take half the time

astral wave
#

Could any one give me suggestion how to reduce memory blueprint on webgl project. Problem is that there is a lot of images downloaded via runtime and displayed in preview. Even with correct compression for the platform it still take quite a lot of memory all the time. And I keep hitting memory cap on iPhones (around 300mb it start dying. browser should be able to handle 500 mb, so my guess 200 goes for browser it self and then ~300 left for webgl.)
Tried even compressing them to correct format and not png or jpg before downloading. After downloading and added as sprite the png file it self is discarded. Any ideas would be helpfull

grim blade
#

hello everyone, i have a problem. how to show render texture on webgl?

astral wave
grim blade
#

i don't know why and how to fix that

astral wave
grim blade
#

ah ah, i put it on the UI

astral wave
#

So most likely it is more UI problem than webgl. You just notice on webgl, as it is considerably slower so timing might be different on when first canvas update is called and checked if UI is used or not.\

astral wave
# nocturne timber

So on editor you dont have this but only on webgl? Does your editor have ANY red errors? regardless if it works or not?
How heavy is your application on Memory aspect?
Are you using some webgl not supported features like: threading/tasks or VFX graphs?

nocturne timber
#

no

#

my application has some sprites

#

then 3d glasses models

#

i use webcam to do face tracking and place those glasses models on the face

#

then theres options for taking pictures and sending email too

astral wave
nocturne timber
#

im using zappar

#

for face tracking

#

it is

#

i use a keyboard plugin that then can be used on touch screen

astral wave
#

To make HTML elements receive a keyboard input, set WebGLInput.captureAllKeyboardInput to false. This way, the application receives input only if the WebGL canvas has focus.
If it does not work only for webgl most likely either your canvas dont have focus or your webgl input was disabled. Also make sure it set to run in background to ON

astral wave
#

well that was quick. lucky find!

ivory shard
#

how can I host a webgl game on my website

nocturne timber
#

U MAKE A DIV OUT OF YOUR GAME

#

go to the location of your unity webgl build, then you open index.html, now you add the elemts of your website or your website in general there

#

it works

hallow sequoia
# nocturne timber go to the location of your unity webgl build, then you open index.html, now you ...

In principle this -- but instead of applying to the build artifacts after a build, you can create your own WebGL Template by following the "Add a WebGL Template" section of this page in the docs: https://docs.unity3d.com/Manual/webgl-templates.html

That way you don't have to remember to apply changes after a build since you can just add the desired changes to the template and build your webGL player onto that.

charred briar
#

That's definitely the right answer :D. Also keep in mind the templates do change depending on your Unity version, so if you upgrade your project later you may need to revisit the template

astral wave
#

Could anyone guide me to understanding while i have this behavior . First image is editor memory profiling, and second is webgl build. The size of shader usage have quite weird difference. Reducing reference count should be one way of optimizing, but I think the size is still too big for shader and its variants. any ideas that could guide me to optimizing?

high patrol
#

If you want to embed a webgl game within an existing webpage it may be easier to use the react component though--plus you can do you html and css changes to make the content surrounding the game more than just a white blank page ๐Ÿ™‚

random talon
#

will WebGL1 be removed from unity?

astral wave
random talon
#

So from 2023.1 ok

#

I wonder if there is a way to force webgl2 on old hardware

#

Cause as far as I understood its just the browser rejecting to run it when the pc specs are too old

astral wave
# random talon I wonder if there is a way to force webgl2 on old hardware

there is no way to force things that they dont have. Its like forcing them to update their drivers or buying new pc. Best you can do is to have nice HTML alert that you are sorry that this website does not support your device. Please use something newer and a link to good pc setup ๐Ÿ˜„

Or you can try creating streaming service, which will actually render you stuff somewhere and then just deploy video, cloud webgl if you must. It will work on almost all devices. Is it realistic? no not rly, but sounds good ๐Ÿ˜„

random talon
#

Yeah not really realistic if the user count is high

#

Ok then, I just need to know when the user pc can't handle webgl2

astral wave
#

The problem if you need that low end users to be included, try checking Three.js or other more browser native approaches.

random talon
astral wave
#

Alternative to Unity and Webgl. Three.js, playCanvas kinda, and there some more that is 3D graphics on browsers. They have better performance and lower requirements. And most likely less limitations. However there is price, it is not Unity.

deft mural
#

Could anyone guide me to understanding while we are developing vr applications and at that time i want to create a site using webgl also.

but i used the oculus intigration and XR Integration so that reason i can't abel to work on webGL.

so how i can create a multi-device application, which app user can run in oculus, Laptop or Desktop, and as well as in browser.

astral wave
#

https://assetstore.unity.com/packages/tools/integration/webxr-exporter-109152
Have in mind this is 3 years old information. When you making webgl, you dont really make multi platform stuff, webgl is like it own platform with many limitations. Maybe there is better approaches these days how to implement it on webgl. As at that time Oculus intergration kits or XR integration kits was not aime at webgl at all so they did not rly worked. Now it might be easier, sorry all I can do is this.

Maybe @charred briar could give you more new information.

Use the WebXR Exporter from Mozilla on your next project. Find this integration tool & more on the Unity Asset Store.

deft mural
#

@charred briar please can you give more information on it ?

deft mural
#

but when we using the web XR, at that time photon server can be suported or not. reason of in my last project we can't abel to use photon server for webXR project. that did not run perfectly.

astral wave
#

WebGL supports only WebSockets. Photon should have support for it. But if you want connect to mobile devices or PC you will nee method to use multiple transports. Mirror Using multiplex for that, I would think photon should have something similar.

hallow sequoia
# astral wave https://assetstore.unity.com/packages/tools/integration/webxr-exporter-109152 Ha...

While youโ€™re right about there not really being many XR games based in webGL today I would politely advise you not to discourage the idea in others.

WebGPU is a bit of a game changer for web based products because it will allow comparable performance to โ€œnativeโ€ applications.

Iโ€™ve only toyed around with webXR (the concept, not the asset) by creating a toy tower defense game (except you can pick up and throw the minions). I had to be spartan on the graphics side but I was happy I had a XR game experience going through my web browser.

tranquil tree
#

webgGL build: I have a video with sound file playing and the sound is set to 3d. After the build the sound is 2d. Any idea how this is happening? Attched are my audio settings.

#

thank you as always everyone here is amazing.

#

video setting for reference

#

In my build settings i noticed that "spatializer plugin" is none. Could that be it?

charred briar
# deft mural <@229302061840203786> please can you give more information on it ?

Thanks for the shout out! Yeah WebXR through unity has been.. mmm very very interesting.

I haven't tried in a few months, but ran about a dozen different framework tests and builds. There are some compelling things for sure--- but we ended up just using raw webgl frameworks and removing unity for our webxr stuff. It was just too unpredictable with unity in the mix, especially for cross browser support...

#

But yeah, we definitely use photon with webgl in non-vr contexts!

#

They have some samples on their site for it.

#

But yeah, definitely take a day and play with the webxr exporters you can find in the assetstore for both AR and VR. Some are just repacking a scene to kinda work in threes.js, but others do interesting things. I absolutely wish I had a free day to dig into it more. I feel like there is a success path there. We did have an experimental plugin we tossed together for a while - but I removed it from our templates internally just cuz we couldn't get time to maintain it. And we built it either some commercial plugins that stopped us from going open-source with it ๐Ÿ˜ฆ

charred briar
#

Also, I found other interesting projects just digging through public github

astral wave
# hallow sequoia While youโ€™re right about there not really being many XR games based in webGL tod...

Thank you for your opinion. While it was not the intention to discourage other people, rather to inform them that currently webgl is not the best place for VR. As person who loves VR i know how much performance effects the experience, how much even a little frame drop can cause nausea for a lot of people. And I want people to experience best VR experiences. And as developer I know how WebGL makes optimisations so so so much harder, like if you want to have 72 fps (for 72HZ devices) on webgl you will need at least 216fps on PC build and stable at that. So if it is first VR project WebGL is really not the best place for it.

I too wait for WebGPU, and from what saw in forums there are already kinda working version of it for unity, but even Unity devs said it will take long time until it will be as smooth as webgl2, and then more time to overcome it. So I am excited but at the same.. well doubtful on immediate effect. And if we talk about phones and WebGPU, apple will take their sweeeeeet time to enable that feature on their devices, same as it was with webgl 2.0

hallow sequoia
# astral wave Thank you for your opinion. While it was not the intention to discourage other p...

Itโ€™s so wild that one can distribute a VR experience over the web. Building VR experiences definitively requires that one knows how to properly allocate a performance budget. If that person has never profiled a webGL game then they arenโ€™t ready yet to tackle the resource starved platform that is a distributed web VR experience.

Unity devs are hopefully busy at work getting Unity ready to run on we GPU. Iโ€™m bias ofc because I love distributing my games over the web.

Iโ€™d like to return to my web VR experience one day and make it better. We do exist even though itโ€™s a rare person to want to build such a thing ^_^

granite hearth
#

can i have an AR webgl made in unity? when i build i have a black screen and no camera..

charred briar
#

And yes, we do lots of WebAR, you just can't use things like ARFoundation ๐Ÿ™‚

#

But its a lot easier to not go through Unity for WebAR

#

imho

odd obsidian
#

Hello, beginner here. This question is way over my head, but it keeps bugging me. When I build an empty project into game, it uses a lot of resources when playing it. I figured out Application.targetFrameRate changes that. So, how do I tell the Unity game to behave more like Windows Notepad? Show something on the screen and not update until user input or event. For example, if I am making a little text-based webgl game, simple visual novel, how do I make sure Unity WebGl game will use as little CPU power as possible? To save battery or to give time the device to cool while the player is reading. Do I manually set Application.targetFrameRate to zero until some event fire or something?

odd obsidian
sweet oriole
charred briar
#

For that client we paused it until the user clicked on something, it was a huge help.

#

We also were generating a screenshot on right click for menu overlays etc and sending it the web end as json. Might be an option as well to show just an image.

#

That was back in Unity 4/5 though. So there may be better ways nowadays.

odd obsidian
#

Thanks!

ashen matrix
#

Is there a way to Trigger a specific Szene via Link?
For example:
Index.html#scene2 -> to force the WebGL starting with scene 2 than the mainScene?

timber prairie
#

I got this error on my webGL build and I can't find any discussion where someone is experiencing the same error. In the build folder the file is there. What might be causing this?

charred briar
charred briar
fallen fjord
#

Is there a limit to WebGL builds? My project is pretty hefty now (9g) and im afraid of building it.

arctic rose
#

In theory no, but who wants to download 9 gb every time they play the game

sweet oriole
buoyant citrus
#

how come whenever i build my unity game to webgl and put it on itch.io the actual camera view just goes completely black, the quality level is at its lowest and every material has full emission

charred briar
fervent delta
#

Is there a way to debug WebGL build so that I can see on which line error happens?

astral wave
#

Anyone tried Unity 2023 with webgl build? I tried profiling same project, but the memory usage for 2023 is 100mb+ bigger than 2022. I want to confirm it is really the case.

#

Mostly worrying thing is Native part, as there is no way to handle it normally.

#

A - 2023 Build
B - 2022 Build

novel kiln
#

Hi ! We have a game with some video content. We build a custom video manager around the Unity video player. Recently we have update to Unity 2022 from Unity 2019. Since then, it seems that the video player is having problems with WebGL, especially when I'm using Bluetooth headsets: video freezing and/or sound speed up. Has anyone experienced this kind of problem before?

random talon
#

I'm trying to run my webgl game on local browser but I get these errors:

"Uncaught RuntimeError: null function or function signature mismatch"

"Uncaught Error: A cross-origin error was thrown. React doesn't have access to the actual error object in development."

vestal cloak
random talon
#

What does this settings actually does? I read on the unity documentation that turning it off will increase performances.

astral wave
#

But maybe someone can give better answer

random talon
#

So with none, in case of error I guess it kinda provides no infos, got it

sweet oriole
sweet oriole
astral wave
astral wave
#

Q: Does this affect WebGL and streamed games?
A: Games on all platforms are eligible for the fee but will only incur costs if both the install and revenue thresholds are crossed. Installs - which involves initialization of the runtime on a client device - are counted on all platforms the same way (WebGL and streaming included).

#

This no way explains how it wil be working exactly?

sick dust
#

Right now, WebGL games store data in PlayerPrefs and cache the game in the browser's IndexDB. If the player / player's browser clears data when closing the window/tab, that data goes away. So if they play again, they will be seen as a new install?

#

And when publishing to platforms like Itch.io, every new version is at a different path within their domain and so the PlayerPrefs data and other stuff is not carried over, so each new version of a game will be seen as a new install?

hallow sequoia
# astral wave This no way explains how it wil be working exactly?

Does anyone know how the new pricing impacts web players? Something I'm a little confused by is "what if I use a CDN" to distribute my unity web player.

From a technology perspective seems like the "install" (and thus the install tax) would happen when a CDN cache server saves the file. If a user pulls from the CDN cache, that action seems like it shouldn't count as an install. But it probably won't work this way.

Again from a technology perspective for web players if the player navigates to a web page using a browser that contains the game then game is cached locally in the browser. If the player reloads the page is that another installation?

Another question -- does the web player installation count per device or no? E.g. if I open my web player in Chrome, Firefox, and Opera is that 3 installations or 1?

high patrol
#

What if my WebGL build is LAN based only? No devices talk out to the internet

#

I have some guesses for some of the webgl applicable changes.

Q: How are you going to collect installs?
A: Probably a registry value and then sending that info to a Unity server when online.

Q: Is software made in unity going to be calling home to unity whenever it's ran, even for enterprice licenses?
A: Yes. When it has an internet connection it will try to phone home. While it isn't connected it will just update the registry value.

Q: Does this affect WebGL and streamed games?
A: Every time your browser refreshes a WebGL game it counts as an install. If a botnet were to connect to your WebGL page you would get financially ruined in fees.
hallow sequoia
hallow sequoia
#

Malicious actors could botnet a unity web player page and screw the developer out of their lifetime installs/ruin them financially.

If youโ€™re planning on using Unity you 100% are going to want to LLC so if you do get screwed over it just bankrupts the LLC.

sweet oriole
grim blade
#

hello, i want to show keyboard on webgl mobile? How to do that?

astral wave
grim blade
#

thank u

grim blade
astral wave
ancient cipher
#

Hey ,
i have created a unity application witch hits the API using UnityWebRequest now in that request i need to send a token X-CSRF-TOKEN which i get as a response Header of my previous hit

#

Can anyone help

high patrol
#

isn't that a service you have to enable in your .net server?

ancient cipher
hallow sequoia
# ancient cipher Anyone know how to get it fixed ?

UnityWebRequests work just like any other request/response library or tool (like curl)*. Which is to say that if you can figure out how to do the request/response/request/... sequence using something like Postman (GUI) or curl then you'll have the fundamentals to know how to do it in UnityWebRequest.

in that request i need to send a token X-CSRF-TOKEN which i get as a response Header of my previous hit

You need to extract the X-CSRF-TOKEN value from the first request. You can do that using the UnityWebRequest.GetResponseHeaders().TryGetValue("X-CSRF-TOKEN", out csrfToken) api.

Here's some sample code:

using (UnityWebRequest request = UnityWebRequest.Get(BASE_URL + "/auth"))
        {
            yield return request.SendWebRequest();

            if (request.result != UnityWebRequest.Result.Success)
            {
                Debug.LogError("Error fetching CSRF token: " + request.error);
                yield break;
            }

            // Extract CSRF token from the response headers
            string csrfToken = "";
            if (request.GetResponseHeaders().TryGetValue("X-CSRF-TOKEN", out csrfToken))
                // 2. Send another request to '/pets' with the CSRF token
                using (UnityWebRequest petRequest = UnityWebRequest.Get(BASE_URL + "/pets"))
                {
                    petRequest.SetRequestHeader(CSRF_HEADER, csrfToken);

                    yield return petRequest.SendWebRequest();

                    if (petRequest.result == UnityWebRequest.Result.Success)
                        Debug.Log("Received response from /pets: " + petRequest.downloadHandler.text);
                    else
                        Debug.LogError("Error fetching /pets: " + petRequest.error);
                }
            else
                Debug.LogError("Failed to extract CSRF token from /auth response headers.");
        }
    }

*Except where it's different.

ancient cipher
hallow sequoia
ancient cipher
#

Yes that is the problem there as browser won't allow so I got a way around by accessing the cookie using document.cookie in js function which I can call from unity and have the token

orchid bridge
#

webgl is kinda redundant, can we have WEBGPU?

#

it's like a really strong version of WEBGL, this would revolutionize web gaming forever

orchid bridge
#

we could clutch this engine in the future

#

this might be against the rule but, please add the WEBGPU Support for the engine ๐Ÿ™ ๐Ÿ˜ญ

fallow hill
#

Has anyone uploaded their game to any websites like crazygames.com with ads integrated

#

I have some questions

high patrol
#

still waiting for multithreading ๐Ÿ’€

astral wave
astral wave
high patrol
#

soooo later

mystic grotto
#

I have a Unity WebGL exportet game running, and for me personally it works on like 15 devices, but a friend of mine, who unfortunately lives too far away for me to test the devices personally always keeps running into the same error after he plays like 5-8 levels(See below). I have all the Player Settings on default. I can not really narrow it down to a specific LOC, because I can not reproduce the error, any ideas on why that could be happening? I use Unity 2022.3.9f1

#

Auf flutter-crush-4ece9.web.app wird Folgendes angezeigt:
RuntimeError: memory access out of bounds
at wasm://wasm/074760d6:wasm-function[71139]:0x184eec1
at wasm://wasm/074760d6:wasm-function[71123]:0x184c87e
at wasm://wasm/074760d6:wasm-function[72385]:0x18e9ff1
at wasm://wasm/074760d6:wasm-function[72382]:0x18e911b
at wasm://wasm/074760d6:wasm-function[75998]:0x19b4c0a
at wasm://wasm/074760d6:wasm-function[76003]:0x19b9a6a
at Module._main (blob:https:// flutter-crush-4ece9.web.app/045de033
-15be-4559-81ac-d3aa9e1b0afe:10:323965)
at callMain (blob:https:// flutter-crush-4ece9.web.app/045de033-15be
-4559-81ac-d3aa9e1b0afe:10:403838)
at doRun (blob:https:// flutter-crush-4ece9.web.app/045de033-15be-4559
-81ac-d3aa9e1b0afe:10:404285)
at run (blob:https:// flutter-crush-4ece9.web.app/045de033-15be-4559
-81ac-d3aa9e1b0afe:10:404457)
at runCaller (blob:https:// flutter-crush-4ece9.web.app/045de033-15be
-4559-81ac-d3aa9e1b0afe:10:403497)
at wasm.//wasm/074760gb.was-function[/2385.0x82911
at wasm://wasm/074760d6:wasm-function[72382]:0x18e911b
at wasm://wasm/074760d6:wasm-function[75998]:0x19b4c0a
at wasm://wasm/074760d6:wasm-function[76003]:0x19b9a6a
at Module._main (blob:https:// flutter-crush-4ece9.web.app/045de033
-15be-4559-81ac-d3aa9e1b0afe:10:323965)
at callMain (blob:https:// flutter-crush-4ece9.web.app/045de033-15be
-4559-81ac-d3aa9e1b0afe:10:403838)

#

at doRun (blob:https:// flutter-crush-4ece9.web.app/045de033-15be-4559
-81ac-d3aa9e1b0afe:10:404285)
at run (blob:https:// flutter-crush-4ece9.web.app/045de033-15be-4559
-81ac-d3aa9e1b0afe:10:404457)
at runCaller (blob:https:// flutter-crush-4ece9.web.app/045de033-15be
4559-81ac-d3aa9e1b0afe:10:403497)
at Object.removeRunDependency (blob:https:// flutter-crush-4ece9.web
app/045de033-15be-4559-81ac-d3aa9e1b0afe:10:17032)
at blob:https:// flutter-crush-4ece9.web.app/045de033-15be-4559-81ac
d3aa9e1b0afe:10:1913
at doCallback (blob:https:// flutter-crush-4ece9.web.app/045de033-15be
4559-81ac-d3aa9e1b0afe:10:102753)
at done (blob:https:// flutter-crush-4ece9.web.app/045de033-15be-4559
-81ac-...

mystic grotto
#

If it is of any help, i created a simple Match 3 game, so nothing special, just a 2D game. They use a Galaxy Tab S6 lite for testing

charred briar
#

Sounds like it ran out of ram.

mystic grotto
charred briar
#

Or they opened a bunch of stuff in the background

#

Or other tabs are active

#

I'm not sure WebGL is supported on mobile yet

daring lake
#

4gb memory is device memory. Most mobile browsers have their own memory limit. For example iphone x limit is like 350 mb ram. At 400 it crashes. Newer devices have higher limits but anything over 500 is a dead sentence

#

also another problem with webgl and mobiles is your teture formating. PC likes DXT format but phones cant handle that and needs ETC or ASTC. So if you build your build with DXT, on mobiles all textures will be decompressed to RGBA and that will increase your memory usages 4 times ^^

#

memory on mobile webgl is such a pain ๐Ÿ˜„

mystic grotto
#

Wow that is crazy, the ram usage dropped from 300 to 150MB, when using ETC2, you may have just saved my master thesis, thank you very much!

#

Here are all my "other settings"

daring lake
# mystic grotto Wow that is crazy, the ram usage dropped from 300 to 150MB, when using ETC2, you...

No problems. ETC2 is older and supported on more devices. ASTC is newer and some devices dont support it. But it is easier to find ASTC converted than ETC2, for example if you want download some images and dont use CPU to compress them on run time (tho from my tests it is not worth downloading already compressed images). So I would recomend ETC2 in most cases. https://docs.unity3d.com/Manual/class-TextureImporterOverride.html
I think new iPhones supports ETC2, but this table states it doesn't. Forgot how it really is sorry. We are using ASTC, but for different reason.

mystic grotto
#

Thank you very much for that information, that is really helpful

#

I will just try both formats, first ETC2, and let him test the app if it does not work i will try ASTC, maybe it works.

karmic apex
#

Any fix for this error in webgl?

arctic rose
#

You can't run WebGL games directly from the file system. If you want to run them locally you have to do "build & run" in the editor or set up your own local server

grave ember
#

You can also run the simplewebserver with cmd if you can find the file path for it if you already built and don't want to do it again

karmic apex
#

thank you! I didn't know that before.

minor crane
#

Hey guys! Is it possible to host a Webgl game using docker?

arctic rose
#

Yes, just like any other static website

minor crane
#

Do I need any dependencies?

#

Or could I just host a node server with the index page?

arctic rose
#

It's literally just static files. You can host it with whatever serves static files.

#

The only gotcha is that if you compile the project with file compression, the server must be able to handle that compression format

mystic grotto
clear grotto
#

is targeting webgl build in unity worth pursuing atm? is there a minimum phone spec requirements for it to run at an ok framerate? (i'm working on a top down multiplayer 2D shooter and want to target mobile browser for multiple reasons)

#

i tried phaserjs and cocos creator and they're pretty fast, but i'd really prefer to use unity if the end result can be just as fast or close. some examples i tried will crash my phone browser but that might be because they're build on older versions ๐Ÿค”

mystic grotto
clear grotto
mystic grotto
#

And i do not think there are any official documents as one comment says "Unfortunately there isn't any official document on the internet and the numbers are experimental that are calculated by developers. "

clear grotto
#

ah , thanks .. i'm working on the first couple of scenes on unity and cocos creator at the same time to visually see how well they run but tomorrow i'm gonna research as much as i can about optimizing for webgl in unity because i'm sick of writing javascript and alot of the stuff i have to do in cocos is already in my assets packages in Unity ๐Ÿ˜…

mystic grotto
#

Personally i use the Flutter Unity widget(https://pub.dev/packages/flutter_unity_widget), which basically adds the webgl as an iFrame into the flutter application and allows me to add my game in to a Flutter Application which makes it possible to create an iOS/Android and Web App at the same time, while only coding it once. Maybe this helps

thorny patio
#

Not sure who to ask, but does unity's authentication work with webgl?

#

We added the package/set up simple anon sign in, but not getting any call backs and noticed that the package doesn't explicitly say it works for webgl

high patrol
#

if it relies on system.threading somewhere to do an async call then probably not. You'd have to override async threads to be coroutines (Unitask style)

grave ember
#

I have a js library function that im calling from c# and giving it a string but in js it seems to be automatically converting it to int i guess because js isn't typed. any idea how i can fix this?

#

top one is what C# sends bottom is what js ends up with

#

nvm figured it out, I needed to run the UTF8ToString() function on it because the number is a pointer

fast lodge
#

Hi, I have a server in node js.
And I have created a an API which will server the webgl build's : index.html file on that url.

But the issue is that the index file is unable to access the build data and template data(generated with the build)

So how do I serve the build file so that the game actually renders, right now it's just showing me a text : TEST WEBGL, and no game canvas is being rendered.

arctic rose
#

well you have to make the API serve all files in the build, not just index.html

fast lodge
#

Here's the snippet :

// Serve the Unity WebGL game by _id
app.get("/api/playGame/:id", async (req, res) => {
  try {
    const gameId = req.params.id;
    const folderPath = path.join(__dirname, "Games", gameId, "Builds"); // Include "Builds" subfolder

    // Check if the folder exists
    const folderExists = await fs.promises.stat(folderPath).catch(() => false);

    if (!folderExists) {
      return res.status(404).json({ error: "Game folder not found." });
    }

    // Serve the index.html file from within the "Builds" subfolder
    console.log("Folder : ",folderPath)
    res.sendFile(path.join(folderPath, "index.html"));
  } catch (error) {
    console.error("Error:", error);
    res.status(500).json({ error: "Internal Server Error" });
  }
});
arctic rose
#

You'll have to change your URL structure a bit. You can't have it serve the index file from that URL. It won't be able to load the other files from that.

#

It could be something like /api/game/:id/play and /api/game/:id/:file serves the other files

fast lodge
arctic rose
#

You need two endpoints, one that serves the index and the other that serves all the other files

#

Or just one endpoint that serves everything in the directory

fast lodge
arctic rose
#

Yes, but you might need to specify that it serves index.html if no other file is specified

#

If you google for "serve entire directory in nodejs express" it'll explain it

fast lodge
grave cradle
#

where can I post jobs?

keen urchin
somber questBOT
grim blade
#

hello, i have a question

#

sometime my audio in webgl don't work on ios device

#

How do I fix it?

mystic grotto
#

Anyone any idea, what that error could be? I unfortunatelly do not have access to the device, so i can not debug it. It is a Samsung Galaxy A40 device, where the game is played on

grave ember
#

Any good fixes for the weird z fighting webgl gets that don't show up in editor or standalone? Can't really change the model for a lot of cases I'm getting for stuff that actually just needs small details like faces and junk.

hallow sequoia
grave ember
#

its your typical Z fighting, on standalones you see it when you have two planes in the same spot but for webgl it happens if stuff is just close together it seems

#

from what ive seen online it seems to be a common issue something about chrome having a small z buffer

stoic tinsel
#

Push your camera near plane out a little bit. You probably donโ€™t need the default 0.1M.

charred briar
#

Or delete one set of faces

grave ember
#

Neither of those are really much of an option for things like the eyeballs, and may or may not be doable for the clothing :/

stoic tinsel
#

Ah. Well. In that case, when I were a lad we had tโ€™ ordering table and floating point z buffers were a distant dream. Use renderqueues or passes to handle your own pseudo sort, and good luck.

charred briar
#

Well, you know the limits. No idea how your models are setup or why. I'm not even sure from the photos what's being highlighted as the problem - so not sure if it is even a Z issue. But it's with you now to figure out and resolve:)

tacit dome
#

So videos can't be played from the assets folder in WebGL. What's the best workaround for this?

high patrol
#

streamable assets?

mossy orbit
#

Has anyone had issues with very bad artifacting when playing webgl builds on mac? I've tried 100 things to fix it but have had no luck
compression settings, depth priming mode disabled, different versions of unity (now on 2023.2.0b11), different urp settings, etc

grave ember
#

Seems kinda stupid that they could make a whole 3d render system in webgl but couldn't manage a floating point for the z buffer idk that's just a weird limit to have.

charred briar
charred briar
grave ember
#

Bruh the pics aren't cryptic it's just hard to show z fighting without a gif. Im looking for a way to fix the z buffer or work around it with shaders or something.

charred briar