#🌐┃web
1 messages · Page 3 of 1
Open console with f12, and press okay and check what console error log states. Emscripten is included in Unity so you dont need to include it unless you removed it.
I would suggest have your build loaded from addressables, as then you can load only parts you need during gameplay, it also provides remote loading so you can load from network easily. For bigger files you could use S3 or any other storage place, as versions can be controlled with addressables. Then all you need to deploy your Index.html with some base build to any webservice. As mentioned itch.io is pretty popular.
Sadly WebGL is pain in the ass and not all features that look obvious works on it. If you have Threading, tasks, VFX or any kind of multithreading, you are out of luck. As those is not supported what so ever. So any of these can cause your game work in unpredictable way. Missing textures depends on what render pipeline you are using, there were some bugs with if shader have receive shadow feature it will not be showed, but it was fixed in newer unity versions. For webgl i strongly suggest using Unity 2022.2.3 or above
We do have VFX.. I guess it can't be helped, thanks! I know now not to waste anymore time
ok I opened the console and click ok. This is the output.
But I have now been told by a couple of sources that it is not actually possible to get a html5 application to read from a precompiled x86 dll file. Expecially if the application was made in Unity
The only option is to re-write the library in c# instead.
What Unity version you are using? Different unity versions uses different version of Emscript. It is totally possible that your unity emnscripten does not support linking
On your DLL file, have you enabled WEBGL platform?
it seems linking is only available in static way, and not dynamic. Also you could try to update to unity 2022.2.3 or above, as I believe that from 2022.2.2 emscript version was updated in webgl, so it might have new features. Sorry I do not know too deep about it, just a suggestion.
how do I enable the WEBGL platform in a dll?
In unity editor go to your dll and check inspector platforms section .
I tried running it again after rebuilding with that option turned on. I still had the same problem
hangon it says "exclude platforms" on mine
oh maybe its because I am using Unity 2020.3.5f1
well maybe then wasnt a main problem from the start. You sure those dll dont have any Threading code inside right?
I only use a single thread
also this information might be valuable. sorry I really don't know too much about your project, so this where my knowledge about these problems ends.
I can show you all the source code on github if you want
so do I need unity 2022.2.3 or later to see the options you showed in your screenshot?
because all I get is this?
you have market AnyPlatform, so thats why you dont see options like mine. also it depends on DLL. but as you have any platform market it wont be a problem. The problem is elsewhere.
but I uncheck any platform it just checks the 3 boxes under exclude platform
The dll was compiled using visual studios visual c++ compiler
does unity expect it to be in a different binary?
@astral wave you can see the source code that I used to make the dll here https://github.com/king-paul/Procedural-Generation-Library
you load this DLL directly in your game, does it work on other platforms?
https://emscripten.org/docs/compiling/Dynamic-Linking.html
check if it possible to go with static linking. sorry I dont rly know too much on this exact topic, but from what I seen it might be connected. In your place would create new project and try running only this dll in msot basic way to confirm it is fault of it. then try newest unity version just in case.
It works when I build a desktop application in Unity, it does not work in the WebGL version
I didn't think lib files worked with c# in Unity
Are you sure you can use dll files with html5 applications made in Unity?
That is unfortunately the case, and always will be. C++ DLLs, or more precisely, DLLs containing native x86 compiled code, cannot be used with WebAssembly, since those are DLLs that have been already compiled to target the wrong platform.
In order to use such DLLs, Unity would need to reverse-engineer/decompile them from x86 back to source, and then recompile them over to WebAssembly. This kind of technology is not feasible. The proper way is to take the original C++ source and directly "cross-compile" that to WebAssembly.
https://forum.unity.com/threads/include-c-dll-in-webgl-build.371130/
https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
you are correct, dirrectly using DLL is impossible. sorry.
I got confused with plugins I used, as they works on webgl and comes from DLL, but after double checking I found they had seperate code for WebGL.
I have upgraded the project to unity 2022.2.6f1 and but I still don't see the options in the screenshot you posted.
Can you cross compile into web assembly and link it to a unity build?
Sorry, maybe someone else have more knowledge about that. From what I saw, most things are JS or TypeScript written to run on browser, and everything else is in c#. so... it seems like there is a lot of manual rework needed 😭
Good Day Devs,
I am working on multiplayer WebGL experience with "Agora Voice WebGL Community SDK" and "Ready Player Me".
After adding both the SDKs, I noticed there are two different WebGL templates.
I combined both the HTML and JS codes from Agora and Ready player me, But seems to be there are multiple bugs that are causing issues in the application while running on server.
I want to know if there is a procedure to combine both the template and make it work efficiently.
Thanks
Well both of them uses custom HTML template. You will need to combine them both into one.
https://docs.unity3d.com/Manual/webgl-templates.html
In short now you should have folder WebGLTemplates in your project. in that folder you will find both templates of your SDK. Create new template folder in that folder and combine HTML code that exists there (not only copy replace files, but manually edit text). Make sure there is no duplicates and all nessarasy JS stuff is included.
If you have errors that happens only on server that is different story. There is high chance that plugins are incompatible, for example uses parameters that uses same names. The easiest method is to open console on the browser (f12) and read the console logs, investigate source and try find core error names. There is no automatic way, you will need to do that manually.;
Yeah I did exactly that, But seems to be there are some issues when loading the scene and initalizing the Agora engine...Though there are errors shown in the console...Its not so very understandable since its a compiled html error.
Anyways thanks for your reponse.
Best to host from a web hosting provider backed by a CDN. Not exactly sure what problem here is though.
@high patrol Poki is a web game portal, just like Armor Games, Y8, CrazyGames... You generally try to publish your game as an iframe pointing to your site and getting it on as many web game portals as possible.
Not really a problem per say - just looking for ideas which you've kindly given. Thanks! Supabase (our database solution) has a CDN storage service, so I'll probably end up serving the build files to my frontend from there.
do coroutines not work either?
When I went to itch.io I saw some web traffic for a game on there pointing to some url that looked like 8dfx8fCDN.poki.com So I assumed they did CDN stuff as well
But yeah Danny's got the bullet point, find a CDN to host it
coroutines do work since they're not multithreaded
coroutines Does work. You can use UniTask project to have tasks working as well. But it will be single threaded, just syntax will be same as threading.
You can enable developmode and change error loging to full stack trace in publishing settings. this way the compiled error will be way more precise
Ah, thanks for the info. No wonder they were so hostile towards iframe uploads 😄
Does anyone has already tryed to publish an Unity X Vuforia Experience with webGL ?
I think I had a stroke reading that
Sorry not to be a pro and being discovering. I would be more than happy to learn why is so obvious, may be you could explain me 🙂
Vuforia Engine supports AR app development for Android, iOS, Lumin, and UWP devices. See: Vuforia Engine Supported Versions here https://library.vuforia.com/platform-support/supported-versions
Vuforia Engine supports the following operating system, tool, and device versions for developing apps with the Vuforia Engine platform.
Doesn't say webgl, so probably not
Okay thanks, I didn't get it !
If you don't mind ditching Vuforia, there is this option:
ParticleSystemRenderer particleRenderer = emiter.GetComponent<ParticleSystemRenderer>();
// Get the particle system's material
Material particleMaterial = particleRenderer.material;
Material clonedMaterial = new Material(particleMaterial);
clonedMaterial.EnableKeyword("_EMISSION");
// Set emission intensity and color
clonedMaterial.SetColor("_EmissionColor", emotionsOptions.emissionColor * emotionsOptions.emissionStrenght);
clonedMaterial.SetFloat("_EmissionIntensity", emotionsOptions.emissionStrenght);
clonedMaterial.mainTexture = emotionsOptions.sprite.texture;
particleRenderer.material = clonedMaterial;
Could anyone tell me what is wrong with this code when I want to enable emission for the material of particles. Several notices of mine:
- in Editor, the emission is visible and emission strength control brightness, however on inspector The Emission parameter is showed not enabled.
- Even if editor you can see emission, on webgl build the emission is off. (On particles materials which have emission enabled by default things emission works as intended.)
Any ideas?
so it seems
material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.None; is needed to make change visible on editor inspector. building webgl to check if that solves problem there as well.
Update: webgl still does not make particles to use emission with this code.
Update: If particles are set to have emission before build, it have correct emission. Conclusion: activating emission during runtime does not work on WebGL. Any suggestions?
Trying to upload my web game on itch but got this error, how can I fix it?
Itch.io doesn't handle brotli compressed files. Use Gzip.
thanks!
Is there a software for that? it seems a thing only for text...
Oh its a player setting
You can also unzip brotli files with an open source app called PeaZip. Kind of annoying 7zip doesn't support it yet
Anyone know if there's a way to stop shortcuts like Ctrl+S and Ctrl+W working in the browser when playing a unity webGL build?
I don't think that would be allowed (security wise). You can prevent the website itself (html & js) from receiving keystrokes, but not the browser afaik. Unless you do a custom chromium build, that would probably do it.
https://docs.unity3d.com/ScriptReference/WebGLInput-captureAllKeyboardInput.html
have you tried this?
And add this as well to JavaScript side. Will it work? Maybe.
//Using jQuery.hotkeys:
$(document).bind('keydown', 'ctrl+s', function(e) {
e.preventDefault();
alert('Ctrl+S');
return false;
});
//Only with jQuery:
$(document).bind('keydown', function(e) {
if(e.ctrlKey && (e.which == 83)) {
e.preventDefault();
alert('Ctrl+S');
return false;
}
});
Hey, we want to suspend our WebGL app when the Browser/Tab goes in the background (in the player settings, Run in Background = false ) but also need to refresh the app data if more than 24 hours have elapsed since the last refresh when the app becomes active again.
Is WaitForSecondsRealtime a reliable way to trigger that refresh across mobile and desktop browsers?
That is, if the app is suspended and has a coroutine running that uses yield WaitForSecondsRealtime, does it calculate the actual elapsed time once the app resumes?
Thanks for your insights!
I would give up doing it on webgl. As if it is suspended stuff will just not work and move there. In your place I would just use Javascript for tracking this, it would be way easier as it have more control over what you can see. And then either just refresh page if time is too long with js, or send Command to Webgl from js to do what ever you want.
Hi, any one try to make facebook instant game with Unity? does it have any problems? I try to build an samples project and it's size is huge compare to Cocos creator?
I think you need to use project tiny for that
I have tried project tiny once. But it's hard to familiar with that data oriented =)) Well. Maybe Cocos is good choice. I tried it. pretty same to Unity and have oop way of code. I still want to stick with Unity, but can find a solution for build size.
Project Tiny has been discontinued. More web focused engines might be a better choice for now.
Download and load is quite too long for an 40 mb zipped using Unity Webgl :>>
I saw Entities 1.0 is out recently?
Can Addressable can save the day for this build size problem? =))
Yea DOTS stuff in general is getting there, but the pure DOTS runtime and core engine placeholders Project Tiny provided are no longer developed.
Oh. got that 🫡
Addressables is quite good for initial download size management.
Base Unity WebGL build size references https://github.com/JohannesDeml/UnityWebGL-LoadingTest
Yeh, thanks for samples. I'll try it.
I got CORS error at my test project 🥲
So didn't know if that work or not. Use google cloud to store. and struggle at that point =))
Hey thanks, I did a day of trying different things with javascript to handle refresh timing, and javascript isn't any more reliable at handling this either - probably less reliable than Unity. Due to browser differences I came to the conclusion the best way to deal with this is in Unity.
I have a scheme working now but requires running a coroutine that checks elapsed time at regular intervals. Right now the coroutine checks every 60 seconds and runs a couple of lines of code to determine the elapsed time. It does not seem to be a big draw on resources/battery.
I was just wondering if that interval could be increased to 24 hours- it could if WaitForSecondsRealtime calculates correctly when an app becomes active again. But you don't know specifically about that question?
can you save a timestamp for when the user leaves the foreground?
probably could but I don't think that is needed - we already save a DateTime.Now in a variable when the data refresh happens, and we can check the current time against that saved value when the app starts back up with a coroutine running at regular intervals.
I just wanted to know if If I set a WaitForSecondsRealTime for 24 hours is that actual system clock time or Unity clock time, because normally even if you set the time scale to 0, Unity runs underneath to track Real Time. When a WebGL app goes in the background that is not necessarily true (even if Run In Background were true)
I published a little test game on itch.io - https://reverend-speed.itch.io/th pw: money - and all seems well, but I have set the project to run on mobiles (as you can, on itch.io) and it doesn't seem to be working.
I've done this successfully in the past with WebGL and it's a nice, fast way to test WebGL publishing and touch controls. However, in this instance the game loads in the mobile browser, then goes fullscreen and freezes. Can anybody suggest a way to get this up and running as intended (ie. not fullscreen and playable!)...?
I was about to get it running on my mobile browser. What Unity version are you running?
Game is currently hosted on a live hosting site, and not a local environment. any ideas why i'm getting this error?
Ork framework just put out a demo build for 2d turn based levels.
Im testing to see how straightforward it would be to deploy to WebGL on ItchIO.
Ive turned compression off in project settings so that it loads, however i get this error. Ive tested a variety of other approaches and settings but the problem remains.
Any solutions would be appreciated.
The following error comes up when trying to play on itch:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
RuntimeError: call_indirect to a null table entry (evaluating '(dynCall_jii=Module["dynCall_jii"]=Module["asm"]["Th"]).apply(null,arguments)')
<?>.wasm-function[77539]@[wasm code]
<?>.wasm-function[36390]@[wasm code]
wasm-stub@[native code]
@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:308627
invoke_jii@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:385268
<?>.wasm-function[36390]@[wasm code]
<?>.wasm-function[1680]@[wasm code]
<?>.wasm-function[60099]@[wasm code]
<?>.wasm-function[26892]@[wasm code]
<?>.wasm-function[58583]@[wasm code]
<?>.wasm-function[50331]@[wasm code]
<?>.wasm-function[10098]@[wasm code]
<?>.wasm-function[36738]@[wasm code]
wasm-stub@[native code]
invoke_iiii@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:376546
<?>.wasm-function[36738]@[wasm code]
<?>.wasm-function[1877]@[wasm code]
<?>.wasm-function[22451]@[wasm code]
<?>.wasm-function[787]@[wasm code]
<?>.wasm-function[42950]@[wasm code]
<?>.wasm-function[48121]@[wasm code]
<?>.wasm-function[42961]@[wasm code]
<?>.wasm-function[6324]@[wasm code]
<?>.wasm-function[20005]@[wasm code]
<?>.wasm-function[42965]@[wasm code]
<?>.wasm-function[12468]@[wasm code]
<?>.wasm-function[39999]@[wasm code]
<?>.wasm-function[22352]@[wasm code]
<?>.wasm-function[22352]@[wasm code]
<?>.wasm-function[18248]@[wasm code]
<?>.wasm-function[36729]@[wasm code]
wasm-stub@[native code]
browserIterationFunc@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:207207
callUserCallback@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:160405
runIter@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework.js:3:161677
Browser_mainLoop_runner@https://v6p9d9t4.ssl.hwcdn.net/html/7401572/Build/ORK 2d WegGL.framework
Anyone can help me, how can I implement voice chat in webgl?
Hey! Any idea how to fix these errors?
Select a template to use in the build settings
I read that to let a website page sendMessage to my unity webgl build I need to toggle the "Exported for External Embedding" but I can't see this setting, did something changed?
I don't think you need to (or can) change anything to toggle sending messages
Ok thanks, maybe I read old information
Where else can I upload my unity webgl game? I have had great success using IFrame to link all of these websites to 1 github page so I only have to upload to github and have all of the websites on the latest build.
I'm trying to develop a game in the world of iGaming/gambling. I have done this in Unity. If you want to see the demo for reference sake here it is
https://galahadgaming.com/Games/Builds
Note: This demo only works in FULL HD 1920*1080
This demo is a WebGL file. It works fine on Computer and Tablet, but not on Mobile. Mobile would be my main customer.
My understanding is that in this industry most people build just one version of a game (no separate Android/Windows builds, and use WebGL/HTML5. But because of publishing/build issues many have moved away Unity to something like Cocos2D.
This is all new subject matter to me, and I was wondering if anyone had any insight on this process or has experience with Unity building universal builds that work on Mobile.
use unity 2022.2 and above if you want mobile "official support". Tho if you edit template even on order versions you can run on mobile.
Easiest way is to create javascript which check if browser is mobile or not, then pass that data to Unity webgl, and depending on it you change what you need. Like UI or Graphics settings.
My current project runs on WebGL, but well.... you need to do heavy optimisations for it. Like if your games uses more than 500 mb RAM, you are out of luck for pretty much all iPhones and older devices. So unless your game is optimized it will not work. Otherwise it works just fine.
My personal opinion.... Webgl is not for mobile. not yet at least. It works but... well it.... scrap it, FUK WEBGL in general 😄 Want performance use threeJS or playcanvas and enjoy easier development and faster builds, build everything with JS. Want same game on all platforms? use webgl and Unity then and only then. And why in first place you are using WebGL when you can use Application on phone... Less batery drain, better perfomance, way bigger chance users will come back.
relevant to mobile, what compression do you guys use to build for both web-desktop and web-mobile?
Brotli
oh, I mean, texture compression :3
I use DXT for webgl
I build both etc and dxt but they both not support when mobile. I use for facebook instant game :>> they work fine on desktop. but on mobile, when I use devtools, there are log that texture is not support :>>
I use DXT compression. Thought of changing to different, but was afraid of work to select correct compression for device. But can confirm that DXT does work on mobiles.
I use automatic, and on global setings check DTX
other options bepends on object I am using it on.
but this is not very performant 😭
but at least work on pc mac and mobile
at least :3 it works. Let me try it.
as otherwise you need to check:
https://docs.unity3d.com/2022.1/Documentation/Manual/class-TextureImporterOverride.html
as Android supports ETC, but IOs dont. So you can try with ASTC.. But webgl default format is DXT...
yeah. ios doesnot support etc. astc doesnot support desktop =)) I only try on edge so dont know if astc work on other browsers :3
Edge is pretty same and chrome. so will work on most. I tested this setup on Safari, Opera, Chrome and Edge.
Maybe I need to test more about that. Well =)) I start to think I should use Cocos Creator to develop facebook instant game instead of stick with webgl Unity :>>
But many things that Unity can but Cocos can't :>>
I'd say use ASTC. If it runs on mobile, then it most likely also works on desktop with uncompressed textures haha. It will still work, just use more memory on PC@barren pollen
Otherwise you have to make a build for desktop and another for mobile
haha. yeah :3 only if the build size is not the problem 🤣 ASTC work fine on mobile :3
It also should work on desktop, just with more memory usage
I use Compressed ASTC block 8x8 first but it didn't work. Desktop still no support for it.
Yes, desktop doesn't support ASTC, so it will just load the textures uncompressed in GPU memory. So memory footprint is higher, but it should still work. Do you get any graphical issues?
it took very long time to loading
Ah yeah that's true
As it needs to decompress all textures
The only true fix is to use 2 builds according to Unity. Having ASTC is the best method for a single build according to then.
Maybe try a different ASTC preset?
I just use Compressed block 8x8. I haven't try these others?
Maybe a less compressed version loads faster? Not sure
Is there some kind of issue with Input.GetAxis on webgl?
Never had any
You could check if your issue persists with GetAxisRaw as well
Yes, it load faster.
how about new input system?
ok i will try that.
I have to stick with the old one
Hi! I'm trying to build a webgl project, but I have no clue how to add my something.db as browsers won't allow getting the file locally/I don't know how to build it with the game and then access it via code. Anyone got any ideas what I could do?
how to copy a text into clipboard? Like I will have a button, if I press it a text will be copied to the clipboard
Afaik you need to send that data to Javascript and do it there. You should be able to find Github repos with examples.
why does this happen when i make a build?
@void canopy
- Which unity version? Tried updating?
- Using compression? Does the host platform support that compression?
im using itch.io
and yea im using compression
im pretty sure itch supprts it
if you are using brotli you out of luck, you need do something out of box in order to run that compression. Try disabling compression to test. Also this error says nothing, open console f12 of browser and see extended message with more information.
https://itch.io/embed-upload/7424598?color=333333
Does anyone know why this could happen in a WebGL build. The site loads fine in most devices. But this was seen in one device
Maybe just a driver issue on the client side?
Itch.io supports Gzip, but not Brotli.
That's weird, I've used brotli before and it worked, I'll try gzip. Using no compression also failed
You have to look at the console to see the actual error messages. It's a runtime error so it's unlikely to be related to compression.
Okay I have a look, thank you
this is what its giving me
its weird cus windows builds work fine
Hi there - only seeing your message now! I'm running 2021.3.18f...!
- if it works on windows it does not mean it will work on webgl. As it does not support a lot of things, from VFX to threading and tasks.
- If something like this happens, build project in development mode and change stack trace to full stack trace on player publishing settings. With this game will not crash and will show exactly where the error is comming from.
- make sure when you build new project with different compression to update your index.html and loader.js file to so the loading names is correct.
Thanks, I'll try this! I'm out right now but I'll let you know what I find
trying to build caused this issue
Why do my builds keep getting cut off on the bottom bar? I thought the Itchio upload size for webGL was 960x600?
Actually, I got that figured out. Looks like the webGL bar adds an extra 60px. So setting the Itchio size to 960x660 makes it perfect, instead of 900x600. I am guessing 900x600 is for minimum projects, with no WebGL border.
are you using JSLIBS? Webgl build is pretty sensitive, so it will break if there is any errors in the code.
also makes usre your build path and project path wouldnt have any non english symbols
I ended up fixing it somehow, i dont know what did it but i updated the editor and fixed an error in the main menu code
JSON file not working on webgl build of my game
i think
there is no other thing that could go wrong, i tested the other stuff
Show the code that tries to load it
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
dont judge it, it works on other platforms idk if it works on other platforms, i forgot to build it, im stoopid
Yeah remember when I said that that won't work in a build?
no... not really
public TextAsset jsonFile;
then jsonFile.text is the content of the file you drag there
whoa, i misunderstood, i thought it was a completely different aproach. Im sorry for being a dumbass then
Thanks a lot
sorry im disturbing, i went to eat, but what do i replace this with?
string jsonString = File.ReadAllText(filePath);
MyData myData = JsonUtility.FromJson<MyData>(jsonString);
string jsonString = jsonFile.text;
Why is WebGL's default upload size 960x600? Shouldn't it be 960x540? Otherwise it isnt 16:9
So ive built a game in unity, it works totally fine in the editor, and it also works totally fine if I build it for windows but if I build it for webgl it breaks
like the map doesnt generate in the correct place at all
Upload size where? I think the website determines the resolution and aspect ratio of the frame, which is not compelled to be 16:9
Just talking about when you add the WebGL platform to your project. It's default value not being a 16:9 ratio didn't make much sense to me is all
Not that it matters much, was just curious
What kind of game is it, 2D, 3D, what are the underpinnings, and how is the map positioned? Everything else works correctly, and only the map has an issue? Are you getting any errors in the browser console?
its a 2d tower defence game, it bases the map off of the ScreenToWorldPos function, i wasnt getting any errors in the editor or in the browser console
have you tried your code with editor when aspect ration is set to 'Free Aspect" and tried to change resolutions and see how your game handles that?
My guess is that resolution on browsers is a bit less on height? because of browser top bar. Or maybe it is just a left overs from old days. who knows. It just dont rly matter as it as stated depends on canvas and resizes it self anyways...
Im getting this error on the WebGL build in developer mode with full stack trace enabled, but I don't get any errors in unity and it works fine in the editor. is this something to do with exporting it to webGL?
If anyone is interested in using Unity and WebXR -> I created a short YT Tutorial + Github Repo (sample + empty template) to quickly get you started with De-Panther WebXR Exporter and VRTK + Tilia 🙂 https://www.youtube.com/watch?v=e7hVROj9qm4
A short introduction to Unity De-Panther WebXR Exporter (https://github.com/De-Panther/unity-webxr-export) in combination with VRTK (https://www.vrtk.io/).
A working sample can be found here - https://firedragongamestudio.github.io/WebXR-DePanther-VRTK/
The github repo is located here - https://github.com/FireDragonGameStudio/WebXR-DePanther-V...
I haven't watched it yet, but this is literally perfect for me!
Hi, are there specific settings to have for a webgl build so it renders properly on most browsers? I got these warnings so followed them but it renders like white, black and yellow low resolution pixel weirdness on safari and the lighting is incorrect on chrome (both support webgl 2.0). I'm adding screenshots of my player settings, how it looks in safari, chrome and what it is supposed to look like. Is it the webgl settings causing this?
(for context: I removed webgl 1 for this build which isnt shown in the settings screenshot)
Well there are a lot of limitations on webgl. Tho try removing compression from build settings and check if that changes anything. What render pipeline are you using? are you using any custom shaders? are you using VFX?
I removed the compression from build settings but it seems to be stuck loading at 90% now on unity play. I added a few particle systems but not vfx into the scene. Its using URP
when disabling compression did you update the index html file as well? as the names of files to load changes.
Oh no I havent, what do I change in the index html file?
var buildUrl = "Build" + "_" + buildVersion;
var loaderUrl = buildUrl + "/build.loader.js";
var errorReported = false;
var config = {
dataUrl: buildUrl + "/build.data.br",
frameworkUrl: buildUrl + "/build.framework.js.br",
codeUrl: buildUrl + "/build.wasm.br",
this part, make sure that it does not have br or gzip and files names are correct.
No br or gzip in the file, I think the names look ok. Im using post processing and a difference between this and a previous project is that the camera renderer is URP High Fidelity Renderer not forward renderer, do either of those matter?
the camera settings are from the third person starter assets so i didnt change them
what do you mean high fidelity?
is it custom render pipeline of some asset you have?
This is what my camera has as options, its from this third person asset pack https://assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-196526
yea and what is your URP high fidelity profile says? if it is deffered I think you are out of luck.
oh nwm it seems deffered is also supported by webgl
it seems to be forward anyway, this is it's info incase its useful
#🌐┃web message
well it looks bit similar to this tho. Thats why I thought it is compression problem. As WebGL supports base URP without problem. Well sorry in this case I can only suggest you to check if there is any console errors or warning on webgl (f12). Then try building in lower quality settings. and reduce stuff like post proccessing until you will find the culprit,
thanks for your help!
I get these errors from safari
It seems that files I was talking about is not loaded correctly. Or is not found. I would suggest reupload your newly build. Then make sure you clear the Cache before trying to load.
hmm im not sure why but it keeps showing this same error after I make a completely new build and cleared the cache
but it is only on safari and not other browsers?
as it seems it tries to load files from directory that does not exists. I guess the temporary link have changed.
its the same on chrome too, i deleted any old builds to clear anything out, is that the cause?
something with unity deployed is incorrect? Send me link to private I will check if I get same error. so could be sure it is not cache
Also make sure the deployent is succesfull
hello, I am looking for some help with building a webgl game. I am running into an issue with trying to load a txt file, I have been trying to get it to load from dropbox and/or google drive, but it doesnt seem to be working. the bigger problem is that I don't see a way to test a webgl app without building everytime, which can take a while. is there a way to preview a webgl build in the unity editor?
no you cannot test webgl build in editor. Mostly it works similar as in editor, but full testing without build is impossible.
For reading textobject use UnityWebRequests to access them. And in most cases if the target dirrection is not in the same domain you will get CORS error. So you either need to setup CORS settings or load only from your own domain.
huh... I just switching to WebGL platform for the first time in my project and I got a bunch of compile errors for some of my packages. when I looked into it, the Define Symbols list had been wiped clean.
is that normal? I don't use WebGL much. does it maintain a separate list of define symbols to the standalone player?
oh yeah... when I check the diffs in version control the ProjectSettings asset has a different item for "scriptingDefineSymbols" for standalone and webgl.
Thank you for the reply
im trying to make a webgl build for a game i made for a school club that i need to be able to submit as a browser game but every time i make a build it give me the error attached via image and I have never used webgl so i have no clue what causes this
interesting. for me Build defines were the same. Tho I had similar problem before that it got wiped totally. Bbut you can copy paste the list so this work around should work fine.
it would be nice to see full errorhead. But when u have problems like this I suggest you check "development build" on player settings and switch to full stack trace for errors on publishing section.
this way game wont crash and you will see error what couses it in your code.
as you test local build try starting it with Build And Run to check if error appears. as it might be just your local webserver setup is incorrect.
Hi everyone, what is the solution for my webgl build to support multi threading? Is it impossible?
You need native c++ code afaik.
Check the webgl roadmap @light vessel
It's close to impossible for many games haha
Thank you for your answer, I calculate the path of the units of my local game with Unity with multi threading I will finally calculate the paths on the server that will avoid me to bother with that
Ah fair enough. Good luck!
Is there any way to hide the javascript content of a webgl build in any browser developer tools?
i did that but it still gives me the erorrs but somtimes it gives me another error that says abort("both async and sync fetching of the wasm failed") at error at jsStackTrace(file:///D:/built_Projects/TestBuilds/Build/TestBuilds.framework.js:739:12) ... and it happens before it loads. i found this (https://forum.unity.com/threads/webgl-both-async-and-sync-fetching-of-the-wasm-failed-build-and-runs-works-fails-when-uploading.944400/were) it say the diffrent error is cause because of a compresson bug but doing what it says did not fix it
im using netcode if that effects anything
also testing with build and run doesn't always show one off those errors but sometimes dose and when it dosent it wont load even after waitng 30+ min
Does anyone know if Unity's WebGL / PWA builds work on Mobile ??
Hi guys, so I've built my game for WebGL and it works for localhost but when I push it to my website the game doesn't load at all, any ideas?
if u using newest version of unity then it works without warnings.
30+ min might be because net code. as websockets might timeout
did u do what I suggested tho?
so you tried disabling compression? and build and run? what net codee do u use?
website dont support compression? files access setuped incorectly>?
yes. I use this asset https://unity.com/products/netcode?utm_source=youtube&utm_medium=social&utm_campaign=engine_global_generalpromo_2022-06-22_insider-campaign-summer-22-tarodev
hmmm, it should not be asset problems. have you changed transport to websockets>
not entirely sure what u mean this is the first project ive used netcode for so i still dont understand how it works that well
Could you try build and deploy totaly emty scene just to check that you aredeploying corectly?
youtube and documentation will be your friend then.
check CodeMonkey for multiplayer tutorial to understand stuff.
ill try building a basic scene
it works as localhost on all browsers, but when i push it to the website via github it doesnt work
do i need to host the build files on a website like digitalocean?
or is having the build files in my repo enough
having build files is enough. Your website is just set incorrectly.
how would i fix that? if it works locally why wouldnt it work on the website?
because localy (build and run) unity builds webserver for u. it setups correctly. But website and webserver have a lot of options that needs to setuped.
depending on your hosting service
for example
i use vercel to host my website
made a new project and make a webgl build and it works fine
works not locally? with same publishing settings?
have you tried building development build for main project?
it works with the same settings doing a build and run but if i open from file it gives me an error that's the same as the second one i had with the main project
Hey. Thanks. NEWEST as in 2022.2.9 ??
at least 2022.2 It works on older as well, but you will need to change template to not show warnings. Also 2022.2 and above have way more control over the build. But have in mind you will need to optimize your game a lot, as if you reach 500mb memory usage most a bit older phones (especially iPhones) will just crash.
Good to know. oh my build is less than 10 mb. Im looking in the release notes for 2022.2 and only see one thing regarding WebGL. Ill try 2022.2.9. thanks.
Build size is not equal memory usage. 97mb project can easily use gigabites of RAM memory.
oh MEMORY usage. Sorry. Read that wrong. I think ill be okay. It's basically a simple website with fancy UI
tho I am suprised you were able to make such a small build. How did you achieved it tho? as even emty sceene with unity webgl is quite big.
Simple Textures and images with crunch compression. no 3d models.
this is my company website that I built with Unity WebGl: https://www.virulentsoftware.com/
lmk what you think
I am suprised that you did not used PlayCanvas or Three.js for website
yeah.. just more tools i havent learned
do you have a preference between those two that you mentioned?
I just like making cool sci-fi UI with 3D elements
PlayCanvas have online world creator. ThreeJS have less convenient tools. I would say Three.js is superior to others in performance and what it can do. Expecially if you need super small project and high performance.
your website idea is really cool btw! and implemented really well. It feels like website but way more interactive and interesting. Really good job!
Does 3js have a 3D editor? (I DESPISE using html and css to build UI)
Thank you! I appreciate it
i see. thanks
So I assume you are not using UiToolkit for your project then/
yeah no. just Unity UI. But i have been meaning to see what user experience of using UIToolkit was like
I also use DOTween for like EVERYTHING in the UI
and just hope i can tween stuff with the UIToolkit
I moved to UiToolit not so long ago. If you dont like css then you wont like UiToolkit. if you like it, then you will love Uitoolkit. Workflow is different, and needs tome to adjust, but you can do way more things faster and with less bugs. tho if you are using DOTween then maybe that is not such a big difference. I would never go bac to Classic UI tho now 😄
hmm. cool. can you embed 3D objects into the UI fairly easily?
Emmmm, not rly. as mainly Uitoolkit is overlay and do not support world space. Offcourse you can just render 3D objects on texture with cameras and stuff, but it bit a strugle for now.
Metaverse bullshit 😄
lol it has the POTENTIAL to be dope. I assume you dont feel that way about the project youre on
is the project you're on live or announced anywhere?
It is, feel free to check it out and critique, sent link into private.
this didn't help because i'm not getting any errors like that
ok so actually i just realized it does load, it just takes a VERY long time to load the game every single time
its stoped giving me error after changing setting to what is in the attached image but it wont load now
neverminded there are still errors they just weren't showing up because of the enable exceptions
Idk if this helps but i found this seem to be some kind of logs for the second error i was having
how do you start your game?
also have you tried this?
Because CORS should not be effected if you start your game with Build And Run. If you start them differently maybe the it is problem.
I tried with decompression fallback on and off and the other setting to ignore but i still get the errors. Also when it loads trhough build and run i get the attached image but the other error image i get by clicking on the file to start (added image of what i dubble click)
why do you assume it will work if you double click?
It not how webgl projects works. You need to have WebServer to test it.
and you need to put it on webserver. (local or not)
only then it will be able to load your game correctly. also web serer needs to be configed to support compression type you chose. for example in your image it is gzip. others are brotli and etc.
Build and run -> unity creates tempoary web server for you. so thats why error is different. and only this error matters. as this start is correct.
this it the error that matters then cause its the one i get when i build and run
build with these options on it will give you more data about what error it is
On your Editor do you have ANY red errors?\
like any at all?
No and those settings were already on in the build with the error image
you really dont like answering all questions that are there don't you 😄
So from errors it seems it apears after starting listening of ipadress and port (which is incorrect most likely anyways. as it should be localhost:port you using). So I would assume this is problem of NetCode for game objects. Are you using relay? are you using newest NetcodeFor game objects? are you using newest transport layer? did you follow WebGL setup guidelines for netcode for game objects?
You might want to check this for more precise data about it:
https://discord.gg/unity-multiplayer-network
hey, does anyone know any tutorials that would help with downloading a save file from a WebGL build, i know for security reasons you cant do it directly but with an API you should be able to
Anyone know why a sound crashes a webgl build when it loops? my game crashes right when the music should start again.
you have two ways. One just make java script download file function and pass data from unity to javascript. ( I do that with screenshots),
Tho I would just make API to send save to database and load it by account instead of save file.
Console logs mostly would explain it to you. Maybe you unload file after playing and start again null sound object. As looping works on webgl, so it is more about implementation. what Unity version u are using tho? it might be a bug or something
Oh i found the problem i made a script that would scale objects to the beat of the music and forgot i had it get 0.1 seconds before the actual music so when it reached the end it would crash
anybody know why these textures look fine in the editor but terrible when built for webgl?
Looks like its downgrading your textures for webgl. You should check, what the actual texture on the build looks like sourcelike
how would I look at that?
Developer options in your browser, check the resources tab
and if it is downgrading my textures, how would i go about preventing it?
What texturesize are your textures? or do you have a huge atlas texture?
I could imagine webgl has some limitation in max texture sizes
What does your webgl setting say in your texture override ?
you mean like the override here?
Edit/Project Settings/Quality/Textures/Global Mipmap Limit
i don't see textures, does the version i'm on matter? i'm on 2019.4.21f1
I guess you have a quality setting that decreases your texture as vertx said to quarter or half or whatever it is
it's on full res
- something is defaulting to the very low setting
On all quality levels?
Either remove the levels or be sure to set them correctly, so low and highend devices get the right things to be shown
fixed it, thank you
how do i build as a html? i believ i have to change something in th ebuild settings so i can publish to itch.io i dont have an index file
you need to build as webgl. You need to change platform to webgl. If you dont have that option on your build settings, you need to install webgl pacakge from UnityHub
Hey, have they improved the speed of the webgl building new builds?
Depends of what you compare with. With other builds? No it is as slow as it was. The period when they did an upsy with emscripten? yes it is a bit better and bit faster. Especially update with dynamic shaders helped a lot. But it is still slow as hell
I tested it last 2 months ago and it took almost 20 minutes for a small project ugh...
Can you cloud build webgl projects and make them faster?
You can do anything you set your mind to. Repeat builds are faster (less to compile) and yes you could use a TeamCity server and remote build and pack your web projects if you like.
Cloud build from my experience is not faster, but more convenient. If you working machine is really weak, then it will be faster. But as @charred briar mentioned, first build is always the longest. secondary are faster. It depends on your project, on textures on render pipeline settings and etc.
For example if minimal changes were made, it can build in 2 minutes. But My builds normally goes for around 10-15 mins.
i did build it as a webgl
why doent it show the whole thing?
it cuts off at the right
even if i increase the pixels on itch io
Your canvas scaling and anchors were not designed to fit the web display resolution
Set a resolution that matches in your game window for a proper reference, and set the anchors so that the canvas scales properly for all required display resolutions
You also need to set a better screen resolution target in the build settings. Google the size that Itch uses. And preview / test the scale first by using that same resolution in your game view.
why is it that when i make a web GL build and the cursor is meant to be fully transparent, the cursor shows up as black?
I'm not sure if this is the right place to ask this, but I am using Unity Gaming Services' cloud save to save data, and we plan to have our project be hosted on itch.io as a webgl. I followed https://docs.unity.com/authentication/en/manual/SettingupGoogleSignin and got to a point where it seems like google sign in is only possible on android apps as the googleplaygames stuff doesn't seem to exist when the project is set to webgl. Does anyone know if it's possible to use google login with UGS on webgl, or do I need to find another authentication method (or is there an easier way to do this with webgl?)
https://discord.gg/unity-multiplayer-network
I think this would have more people to know about Unity Game Services. Well on webgl you most likely will need to use Browser Login. Aka via JavaScript or what ever google have for it. and then pass data if login succesfull like token from javascript to webgl.
Hey friends, I am looking to profile my webgl build on mobile browsers. Any clues on how to accomplish that?
Cute 😄 Dreams will be dreams. I would give up on this idea. Just optimize on pc browser. for touch use dev tools to run pc browser as device (f12 + device icon on corner of debug tools). Otherwise you will need to setup to send profiling data not to local host but somewhere else. Then setup profiler to connect and load from there. And if you will try to do that on iPhone you will run to even more problems.
For android you can connect your pc to phone and pass at least console data to pc with chrome develop tools. That might even connect your device to editor profiler.
But my honest opinion, if you are making it work on webgl, you need to profile it to browser and it should work on any device regardless.
Visualizing the data on UI can help a lot tho
This is an odd problem. I tried a WebGL build and everything is unloading if I get too far from an area. The Windows .exe is fine and so is the editor. Has anyone come across a similar issue?
https://youtu.be/Ej5XWH1NEfM
I've come across an issue with compiling for WebGL. Going off the main platform unloads everything! I have no clue how to fix it.
I have a very simple game with a size of ~10MB. The game runs perfectly on Chrome, but when opened in MS Edge on some computers the game has massive fps drop and it runs on 10fps or less. Sometimes when clicking the game it runs normally for couple of seconds. Anybody else has experienced something like this?
@bitter burrow which unity version?
click on build and specify the path to your build game and it will automatically start
My game on WebGL seems to have major Z-fighting flickering issues, but when I build and run on my computer it is fine. Is this something to do with browser settings?
I am also planning to make a 3D platformer with a rather large town with a decent amount of assets, lighting, and characters; I am not sure what the limit is for in browser gameplay? This is like a Bullet Hell also.
I'm having the issue that canvas elements don't show up in my webgl build, anyone run into this issue?
Hey everyone, do you guys know how to change this text in a WebGL build? Thanks!
I tried looking into the HTML but I found nothing...
It probably is js related, but I don't really know
Hi I learned unity 3d from "Multiplayer Virtual Reality (VR) Development With Unity
" course in udemy. I completed the course and now after building the apk file I am not able to use it in my android device. The app launched and shown made with unity then it crashed and exited. I have another doubt as well "Can we build this same project as WebGL project?" to host it in the website.
Well your description is quite shallow. About crashing on android device, you should ask it on different thread. But there are thousand and one reason for it: you have some errors in your project. (editor does not creash, but build that is in non developer mode will crash immediately on error.), your build settings for target device was not correct, there are quite a lot build settings on build settings. I would suggest first try building empty scene and try if it works, to check if you doing things correctly. Or you using features that are not available on android but available on pc.
About webgl. Technicly yes, you can build same project on WebGL platform and host it on website (have in mind website needs to be setuped correctly, or use Unity services for simple testing). In most cases it does work. But there are a lot of limitations on WebGL, likes no threading, no VFX and etc. Also game needs to be optimized heavily to run smoothly on webgl.
Thank you for the response. I will check it and reply if I need any help.
Hi guys, I am looking for some asset or solutions where I can push log from build. We have WebGL build so logging into file in pc is not what we need, so I am searching for third-side choice, where we can push log file. Have you any tips what we can use please? 🙂
Backtrace worked for me for a small side project (at least on android, assume webgl works as well)
Haven't looked into it much tho
I will check it thank you
You can change "game" to something else e.g. "simulation" if you don't want to classify your piece as a game. To do that, give your came a custom noun in the itch game page settings
As I said, you can remove this button and load your game immediately but I would not recommend doing so. You might think that it's not a big deal but image someone opening your game-page from a shitty phone. It would automatically start the unity player and probably crash the browser.
@sturdy quartz thank you so much
I am happy to've helped
anyone have any idea why my game might be stuck like this when pressing play on the webgl build on itch.io?
Check browser console for errors
found 1 thing online i will try in publishing settings and see if it does anything
Ok thanks I will try that
anybody know how to make a custom webgl loading screen?
like when your build is loading in the browser
rather than:
or the minimal build
I'm getting this error when I try to build and I don't know what I am doing wrong. This project for class is due tomorrow and I really need to figure out how to fix this and my professor isn't responding
please ping me if you respond
Yeah, you can create a custom template and add it pretty easily
Sounds like it built fine but you are trying to open it locally
The quick way to view the WebGL Player locally is to use Unity's Build And Run option (menu: File > Build And Run). Unity uses a local web server to host your build, and opens it from a localhost URL.
Otherwise you can disable decompression and upload it to itch.io
Or set it to whatever compression itch allows
I was doing it on itch.io, how do i disable decompression?
I know itch supports one of the two compressions. But I'd probably just set it to gzip and enable decompression fallback
https://forum.unity.com/threads/webgl-build-doesnt-load-in-browser.948400/
ooh okay lemme try that
Any ideas why I would be getting:
Unhandled Exception: System.Net.HttpListenerException: Access is denied
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at Program.RunServer()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()```
Using the `\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools`
^ I have to run in admin
Anybody have any good resources for adding Web3 buttons to unity games (payment / connect)
Christ! My small webgl project took almost an hour to build! Unity isn't trying to reduce the build times huh??
Building a project in Unity can take a different amount of time depending on the size of the project, the amount of resources, the plugins used, and other factors. Unity tries to optimize the build process, but in some cases the build time can be quite long.
If you want to speed up the build process, try the following suggestions:
Optimize your resources by removing unused files and reducing the size of textures and models
Also subsequent builds should go significantly faster. Adding compression etc takes longer. Compiling to assembly takes even longer still. And having a decent computer helps just from all the damn shader compiling 🙂
Im barely using a lot, the webgl build doesn't even go over 15mbs...
I use to be able to build the thing in 10 minutes (and I was complaining then) and now its 50 minutes with newer versions of Unity...going backwards! 😬
hi i have some problems
i dont have the webgl module and cant install modules for my unity version
You need to install Unity via Unity Hub to access the module options easily
yes but even in unity hub i cant install it
Did you install Unity through Unity Hub?
yup
Show your module page for the installation?
Give as much information on what is happening as you can. It's not fun guessing what you are seeing.
it only propose me show in explorer
and remove from hub
and people have the add moduls but not me and i dont know why
That's the case for both of your versions? Because you have modules installed in your second one.
oh sorry i forgot , its only the case on the first one and thats the one that i use
Right, because as above, it wasn't installed via Hub. Note the file path differences between the two.
Just remove and reinstall it, save the headache of trying to fix it manually.
https://unity.com/releases/editor/archive
You can get versions here and there will be an option to install via Hub.
Yes
ok thx
Anyone know of a way to export a VR game as webgl?
There are unofficial webXR exporters on github, but there is no official way (make a reply on the unity XR roadmap for it if you want to see it added)
hi, when I import models from Sketchup, my character can walk right through them, meaning they are not solid objects, how to fix?
Did you add mesh colliders?
yup it worked
If you working on webgl, I suggest use generic colliders (like box or capsule) as much as possible instead of mesh colliders. As you want to save performance as much as you can.
Depends what the goal is. Getting primitive colliders on a complex shetchup model can take hours. If he just wants to run 1 model with collision for the player it's not that bad usually
Anyone ever managed to get something like pinch to zoom working on WebGL? I can get it working on an Android build no problem but when building for WebGL the touches seem to be registered weirdly/differently from when testing with an Android build. I'm using the old input API, if I use the new input API no touches get registered at all. Unity version is 2022.1.23f1.
Is there a known difference between how touches are processed on WebGL builds?
Unity WebGL doesn’t officially support mobile devices (see WebGL browser compatibility) but it does implement Input.touches and other related APIs in browsers and devices with touch support. By default, mobile devices display a soft keyboard on the touch screen for entering text into UI
input fields. To disable this behavior, use the WebGLInput.mobileKeyboardSupport property.
Well there is no super approach. Also depends if you using new input system or old (at his point I would give up at old one.). With new imput sytem you can setup touch with more control and you can debug it as well more easily to see what exactly is triggered.
Sorry for not helping more, as in my case it works fine, but I don't use pinch or other multiple touch elements. So cannot confirm or deny anything. But at least new input system lets you config your own multitouch.
I guess main problem is the on webgl your touch is registered by browser and by game. So browser seeing pinch action, will try to zoom in, which might put webgl window out of focus. where you will get weird behaviors (either lose action or action will get stuck as it was never released). So you will need to design you website in a way so it either block browser logic or.... you will need to create javascript which can easily capture gestures on browsers and just pass that data to unity webgl.
Hey guys, is there way how to change WebGL build template via build command? I am building WebGL game always after changes are pushed on git. But I need to change template to minimal and I cant find build options for this one
change the WebGL build template via the build command in Unity. Here's how you can do it:
- Open the Unity Editor and go to "File" > "Build Settings".
- Select "WebGL" as the target platform and click on the "Player Settings" button.
- In the Player Settings window, go to the "WebGL" tab and find the "Template" dropdown menu.
- Select the "Minimal" template from the dropdown menu.
- Close the Player Settings window and return to the Build Settings window.
- Click on the "Build" button to start the build process.
To automate this process, you can create a script that modifies the Player Settings and initiates the build process. You can then run this script whenever changes are pushed to your Git repository.
Anyone has luck having the game works in firefox ? mine works fine in edge. I let Unity open the game, the url is from localhost, and i get NS_ERROR_INVALID_CONTENT_ENCODING error in the network tab
You need to quit trying to use GPT for responses 😄 That isn't a build command.
I think this is what you want:
https://docs.unity3d.com/ScriptReference/PlayerSettings.SetTemplateCustomValue.html
Example, line 211: https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/Inspector/PlayerSettingsEditor/WebTemplateManagerBase.cs
Yes😁
i followed a unity learn tutorial on how to add webgl module and started to build it and it says no web gll module loaded so it says install with unity hub so i click on it and i do have it installed so i dont get what to do
Its exactly what I am searching for 🙂 Thank you 😄
Did you try restarting the editor after installing the module?
ill try
I know manual way how to change it, I was looking for way how to change it via code bcs I am building app via command line 🙂 But thank you too for tips 😉
Make sure you are looking at the Unity version you are using with the project.
is it possible to use OpenUrl and for it to open on the same window? Without opening a new one?
Hey guys, i need to configure CICD with Unity 2021.3.12f1
Anyone managed to do this?
when putting my game on itch the canvas size is way off
its fine in the editor idk why this is happening
You have to set up Canvas scaling and anchors so it will work on all the resolutions it will be played on, not just the one resolution your Game window is set to
These are my settings, they look right to me but clearly smts wrong
Switch the Game window to different resolutions to see how your UI adapts
Specifically those that would be used on the web player
But the more resolutions and aspect ratios your UI supports, the better
should I do anything with the player settings?
In my experience they don't do much, because the webpage will be responsible for the frame/screen size
But I'm not 100% on that
Yo, thanks so much! i got it working now, you have no idea how long ive been working on this
hello team, quick image sizing question
my high res jpeg is 8000x6400px and 13.3 mb on my desktop
when I bring it into unity and convert it to a sprite and webGL overide the max size to "8192" the file becomes 195.5 mb
thank you for any help on this
"Max size" is in pixels in width or length
The file size next to the preview is the size of the asset in RAM for rendering after decompression
The size in build would be smaller after compression, however your texture is NPOT so it might not be possible to compress it
thank you Spazi, i wondering why the file jumped so much as it was already 8000px wide on my desktop. would turning it into a sprite increase it from 13mb to 185mb? Yes my build is a lot closer to 185mb.
Images are always bigger when decompressed for rendering, even the jpgs on webpages though you don't ever see those numbers
Since your texture is NPOT it likely cannot be compressed very efficiently
The Max Size is not limiting its dimensions as it's not over the 8192 limit
always try to use POT dimensions for your graphics
awesome thank you! 🙂
Hi! I am writing a game, that does work in test mode, but doesn't in built webgl. The feature in question is System.Net.Http Is there a way for me to know if the library works on webgl or not?
Hi I am writing a game that does work in
Hi all! I'm trying to build a game to WebGL and having trouble with it exporting all the assets. When I build it I get a blank project. I've tried searching online and some of the solutions I've found, but no luck getting any of them to work. I'm super new to Unity, so I might just be missing something obvious. If anyone is up for chatting about it feel free to DM me and I can send code screenshots and such 🙂 Would super appreciate any guidance.
Are the right scenes selected in the build settings?
yes, i think the problem stems from me having stage direction in txt files calling assets, but i don't know of another way to do it. it works fine when built as an .exe.
Make a debug build to see the logs?
I'll do that asap!
Alright, got around to doing the debug build, here's the console screenshots.
- It shows a firefox workaround, did you try another browser?
- Updated unity already?
- It's your project, debug the errors (;
If you are reading something from text files, then on webgl access to them is very different from pc. You will need to put them in streaming assets folder and user webrequest to load them.
If you are writing something into text documents, forget webgl build, you will need to rebuild all logic of that.
I'm having an issue with create WebGL builds where it displays a solid color (it's the same color as the bottom left pixel of them screen I think). The issue goes away when I enter into fullscreen mode and does not persist even if I exit fullscreen mode. Any ideas on how I can fix it?
well this is some magic stuff you are having. I would assume there is no logs about it? like console logs F12? is the corner pixel is of your webgl product or html? maybe it fails to even render or create html element for you? What pipeline are you using? URP? standart? Do you use any custom code for rendering? what unity version are you using?
Good afternoon. Anyone know why on a webGL build, only non-english speakers have issues with the build? Here is one of the latest errors someone sent me.
so, apparently, it is language settings in the browser that cause issues. If user switches language to 'english' issues go away. that seems odd.
Is unity updated?
Do you use any strings/paths to load data? @jade valve
its multiplayer with PUN 2. This project uses playmaker. It sends some RPC Strings.
If it's just method names it should be fine.
I suggest to update unity and make a debug build and change your browser language to the one causing issues
Sorry for the late response, I went to bed before I saw this. I ended up getting the issue fixed, I forgot to remove some code that resized the window, and removing it fixed it
I got this error when I switched to webgl and it disabled my post processing ArgumentException: Kernel 'MultiScaleVODownsample1' not found. This is the most important part of the error cause else the error would block the whole screen/
Are you using third party post procesing or rendering pipeline? What pipeline it is URP?
Universal fix for these kind of problems. Exit project. Delete Library folder content. Start project again and let it rebuild library again. see if the error continues
unity's postprocessing no pipleine
found error it was something to do with the ambient occlusion one
Hey everyone,
I was wondering if it is possible to pass a memory address from a dll, and use this to create an array in Unity to have "sharedMemory", and avoid copying.
Otherwise there is going to be a lot of copying which is not ideal. Or any other known sollutions for this issue?
Thanks very much in advance
https://docs.unity3d.com/Manual/class-TextureImporterOverride.html#supported-formats
My question is this. WebGL on this table mean windows webgl? as on IPhone RGBA Compressed DXT5 is not supported. Then how to compress webgl textures for correct build. As unity lets choose compress depending on platform, and IOS is not really platform when we talk about webgl/ How to handle this ?
hello everybody, i try to use a websocket in unity (client) my server is node js. it's working in editor but not in my browser (in build)
i try with System.Net.WebSockets; and WebSocketSharp
Hey folks I'm having a problem with a WebGL build. whenever I play in editor I can see everything, but when I build to webGL everything disappears. does anyone know how to solve this???
oh that can be one of thousand reasons. From you forgeting to add scenes you want to see into your build and etc. 🙂 or using shaders or pipeline that is not supported.
how does my config look?
I had problems with forward + on webgl before, change just to forward and check if it okay
I assume that you cant see anything is you see only sky box or something. As you might not spawn character with camera on Webgl as well. but My first guess is forward+.
could you show what you see when you "Build and Run" and then press f12 and check what console says
sure
I don't get any response from f12 and the console has nothing
Wait... you were talking not about Runtime?
yea, can you send screenshot of browser and browser logs?
sure
I was talking about f12 pressing on browser and seeing what it says. is it shader errors is it load errors or what.
https://docs.unity3d.com/Manual/class-TextureImporterOverride.html#supported-formats
Will reconstruct question as got some data from testing. When you build for webgl you can choose one of 3 compressions, or you can choose compression for each texture in editor. The problem is that default compression is DXT, which is used of macOS, windows and etc. How ever if WebGL is loaded on iOS mobile for example, the DXT compression is not supported and it heavily increases memory usage.
So regarding this situation what should be correct approach to handle iOS devices.
- For downloaded textures I can try compressing them via code, but textures that are in build is bit more complicated.
- I could try create script and put it on every object in game, which have two textures references depending on device which one to use. But that would mean I need 2x amount of textures, which will increase build size and download size. Which once again... not nice.
- I could try create different set of addressables assets that would be loaded depending on the device. This saves download size problem, but becomes very ugly to manage. And increasing list of addressables comes with memory overhead as well, which is not wanted.
- I could try to have another project just copy but with different compression default option and just redirect to different webpage or load different webgl with JS depending on device. But once again. Extremely not fun.
Does anyone knows how to handle this hell? or have any more suggestions?
From what I know, I would duplicate the project when I needed to build, then change DXT from there
found it:
GameObject at path 'SVT/Body4' with Mesh 'Body4' in Scene 'SampleScene' but doesn't have Read/Write enabled. Only colliders that have default cooking options, are not scaled non-uniformly, and their meshes are not marked dirty can leave this disabled.
_JS_Log_Dump @ try1.framework.
turns out I'm falling through the floor
It is weird error, as it is better not to have Read/write enabled if you dont need it. as it takes extra memory and stuff. You dont use mesh colider or just normal colliders? but that should work same way on editor.
guys i have a query
a few years ago, i uploaded my game to play.unity.com
now i have lost the project files and want to edit the game
is there any way to download the game or something from play.unity.com?
You uploaded a compiled game. It can't be turned into a project anymore.
damn
i have the project files but everything is pink be it on urp or hrp
ty for the help tho
pink materials is not a problem,. URP and HDRP have material rebuild option which will upgrade all your old materials to URP or HDRP. Or you can do it manually on material settings. Also have in mind project settings needs to be set to have correct pipeline selected. Also webgl does not support HDRP
yes i need some help with that
i set a backup and tried converting it to urp but it's still pink
How did you converted? did you updated URP package as well? What your materials type is right now?
You also don't need to update to URP, and could keep it in the standard built in pipeline. But make sure you start backing up your project and using version control if possible
Can someone help solve this bug?i cant build my game with webgl build.this what i got when i try to build my game
Please open editor logs, and find "Build Report" (have in mind you need do this after trying build), and there you will find way more information which might give you more information. If you can't find it, paste it here (use pastio.io or something like that, dont paste full logs on discord.), then other can try to help you.
what should i paste or copy?i cant even understand whats wrong with editor log after find BuildReport
in build error just before status failed there should be tons of lines that says; oh error was there and here and blabla bla. or just post all logs using paste website or something.
Anyone figured out how to compress to ASTC instead of DXT during runtime on webgl?
Question for people who have experience with Nginx:
Question about nginx with precompressed files (BR):
I have a preconfigured Nginx instance in a docker container.
This container has 2 volumes binded to a file location for served files and another for the Nginx configuration files.
in the Nginx configuration i have set the following:
gzip off;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_proxied any;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application> gzip_vary on;
When I try to use the Precompressed files for a Unity webGL game I get the following error:
Unable to parse Build/New folder.framework.js.br! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: br" present. Check browser Console and Devtools Network tab to debug.
What is the best way to go about configuring the nginx configuration to correctly serve the files?
hello i have a question, who uses node js? for call this aplication in webgl
doesn't webgl use node js? Uses SimpleWebServer.exe. Not sure if that is built on top of something else or what. It lives in "C:\Program Files\Unity\Hub\Editor%UnityVersion%\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\SimpleWebServer.exe"
Is it possible to use SharedArrayBuffers with Unity?
So have an array in WebAssembly, and let it be shared with an array in Unity?
Thanks in advance guys
Hey guys, any suggestion to make a good configuration in unity to export to HTML for a 3D mobile web app?
my suggestion is: don't.
if you still want. Configuration everything on lowest. No reflections, no real time lighting, stuff in bundles and loaded only when needed, as you have super limited memory. Textures compression to ASTC or ETC2, tho recommend ASTC. And.... don't use any video streaming and stuff like that. Have fun.
Memory is definitely the biggest issue. But we are working on some things there 🙂
mmm yeah, but I dont know all the things to make it low. I gonna take it ASTC then.
anyway ty for your a,dvices @wintry flume @astral wave
I'm not sure what your question is, but node.js (in of itself) doesn't really matter in context of unity as a WebGL component. Anything that will let you use a WebGL canvas can use it. And there are help guides if you want to see how to send messages to/from unity via TS or JS if you need
Sorry, I'm French and I asked my question badly. in fact I created a node js server and I was trying to call two unity applications (webgl) in directories and it always opened the same one for me as if there was a cache problem. and I solved the problem.
Hey Guys, how can I ask webgl doubts
With words typed from your keyboard
another tip, start using addressables package. as it will dramatically reduces difficulty to manage memory.
guys im having a error when i try to export the project to webgl it gives me this error
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <9959c9185b684a4d9d56448296fb9048>:0)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:179)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <9959c9185b684a4d9d56448296fb9048>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <9959c9185b684a4d9d56448296fb9048>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
and
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <9959c9185b684a4d9d56448296fb9048>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <9959c9185b684a4d9d56448296fb9048>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
longest one
I've been having an Issue getting my WebGL build to work
Everytime i try to publish it on unity play i keep seeing a blank screen
and an error
in my console
I tried installing a custom package thats supposed to trace where the memory leaks come from but it been no dice
considering the fact that the error is only coming from me building and publishing
i dont think its a code issue
Hey guys,
I have a quick question regarding Unity and shared memory with the web.
I am able to make a shared array between Unity and the web by creating an array and initializing an array at that location in Javascript.
However, i am not able to do it the other way arround, so have an array in javascript and share that with the Unity side. I tried passing the pointer to the array and initializing a NativeArray in Unity but no luck so far.
Any thoughts on this issue? or known sollutions?
Thanks in advance guys!
Are you using an unmanaged javascript plugin inside Unity?
I wrote a sample code.
https://github.com/gtk2k/ShareArray_BetweenCSAndJS
Hello. I create simple webrequest in unity. Created error handling and etc there. But it request fails, browser prints the error, which I don't really like happening on production. I know that you can set to ignore specific errors on Unity, but is there better approach on handling errors on webgl?
worth to say, that webrequest is called in try catch, and should not return any errors
i uploaded my project to itch.io and this error pops up when you play
how can i fix?
Ok i fixed it by changing the compression from brotli to gzip
I have this webGL game, that I recently converted from Photon PUN (using playmaker visual scripting), to Photon FUSION (and got rid of playmaker). Plays great in Editor, but on build, frame rate is really low. My guess is single digits. And my ping to the server is over 2000 sometimes (when in editor was around 150ms). I'm not sure what this 'commit' is in the browser console
Does the slowdown also happen in a dev build that you could profile with Unity?
Hey guys, i'm new to this and I'm trying to get my unity project to be deployed on my website. I was wondering if anyone had any recommendations on how to do so.
I am currently attempting to use netlify
but it doesnt seem to be going well, when I try to upload the build folder to netlify it seems to just be uploading forever.
the file size of my build is 281MB, this shouldn't be an issue right?
@coarse zephyr The netlify web uploading UI can be quite finicky and just retrying the upload can solve it. For a larger build I would consider checking out their CLI options to perhaps get more stability and feedback.
Thanks! I will give that a shot and see if it works. In general, what is considered a large build? And what is probably too large to be hosted on a website?
It doesn't really matter how much you have on the web server (within reason, netlify might want to know 😄 ), but generally it's more about how much the user needs to download to experience your content. I would generally want the initial download size (to see the main screen and what not) to be under 30MB and then load additional content either through Addressables or other means.
Minimum initial download sizes for references https://github.com/JohannesDeml/UnityWebGL-LoadingTest
If you need to download 280MB of content just to boot the game, some of your users would potentially have to wait for minutes just to see the main screen.
ahh I see, I have deployed it with netlify and it seems to have deployed properly, but it doesnt not load. it is stuck on a blank grey screen. could this be caused by the loading amount?
i have been waiting for a while and it does not seem to be loading
Always check browser console. You most likely need to configure Netlify to serve content in the correct format
There are netlify unity templates out there if you look it up
okay gotcha, thanks again
how would I go about delaying the loading of a much larger scene? What I have in mind, is when the game opens for the first time, it is a simple scene with some text and in the background, the main scene will be loading. However, it seems that the browser is attempting to download the entire project at the start.
Unity by default won't assume that stuff might be remote, but Unity has systems such as Addressables to facilitate this sort of stuff. Basic usage involves installing it, marking the scene asset as addressables and using the Addressables API to load the scene.
ill look into it, thanks!
I'm trying to build a game to WebGL and I have no compile errors in Unity, but JavaScript throws an error, but I have no idea where to even look
it's here but I don't know how to fix it
the website I'm loading it to says to set it to uncompressed
i try to look in the script and none of it means anything to me
Does your editor have any errors? red ones. as on editor it will work with them, webgl will die. To find exact problem you want to build dev build, then on publishing settings change logs to full stack to get all exact code line.
no errors in editor at all. Game is using URP, I made a new project and imported all the assets and got the same error
I don't know how to build dev build
gime a sec
building now
have in mind it will take longer to build this way. also if you have compression on, have in mind it will build without compression and you might need to update your index.html if you have custom one. but most likely it will just work 🙂
I have it set to no compression
are you saying to build it this way to find the error or to publish? The editor said not to publish this
I suggest just use "build and run" so it will be hosted localy to see everything.
If you have specific code that needed API and cannot be local, you have no option but to publish it this way. test it. then delete it and deploy fixed version.
it doesn't do this when I play it in the editor
and health is updating
I have a script that updates all of my ui with the player's stats
that's the only error that's coming up
trying to see if I can fix it
This sometimes happens when you have references in your scripts of other game objects. Webgl order of actions might be not the same as editor. For example if you trying to update something in UpdateHealth, but that object is not actually spawned yet.
As you see it start at Overseer.Start(), and then tries access other objects, which also have start, there is a chance that their start is still not done, yet Overseer tries to access them. It is most likely in your UpdateHealth script. Try making sure if things are not null, or create logic that actually handles order of scripts manually
In short: if you reference different objects in start, make sure their start is already finished. You can create Innitialisation method to make sure it runs only after it is requested.
UpdateHealth is a function in UpdateLevels script that is attached to the parent canvas of the UI elements it's saying is a null reference.
So for UpdateLevels to run, the Canvas and its children have to already be created
who creates them? i assume it is not in scene by default?
Overseer and Canvas is in scene hierarchy
Overseer calls UpdateUI, which is a function in UpdateLevels script, UpdateHealth is a function in UpdateUI function
sorry without seeing code I can't help more.
Overseer script: https://hastebin.com/share/abidamuxan.csharp
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
@astral wave UpdateLevels script: https://hastebin.com/share/ukiqojinig.csharp
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
if there's a better way to update UI please let me know, I'm sure I'm not doing it the best way (Particularly since there's errors)
what I don't understand is how I'm getting a null reference when the Canvas is what has UpdateLevels on it. Canvas has the objects as children that the UpdateLevels script is saying is a null reference
I took the easy way out and put the error causing code in a (if component is not null) statement
but if there's a better way to do it please let me know
Only in WEBGL , anyone know what might cause this ?
Random Flickering light looking into one direction, I don't even have any of those in the scene...
the export settings were kept same quality as Editor.
Not sure why WebGL always messed up with bugs..
Issue happens in Editor too but when in WebGL mode..
narrowed the issue when switching to Gamma color space, apparently webgl doesn't build without it.
Is there no way to get around this?
How can I get the .unityweb format on build files?
If you enable a Compression Method for your build, Unity identifies the extension that corresponds with the compression method and adds this extension to the names of the files inside the Build sub folder. If you enable Decompression Fallback, Unity appends the extension .unityweb to the build file names. Otherwise, Unity appends the extension .gz for the Gzip compression method, or .br for the Brotli compression method.
https://docs.unity3d.com/Manual/webgl-building.html
Unity WebGL only supports linear color space rendering with WebGL 2.0. Linear color space rendering doesn’t have fallback support for WebGL 1.0. To build a WebGL player using linear color space rendering, you need to remove WebGL 1.0 API in the Player settings, open the Other Settings panel, disable the Automatic Graphics API setting.
https://docs.unity3d.com/Manual/webgl-graphics.html
Ahh don't know how I missed this, I was wondering why everything was jank in terms of graphics 😅
Now to figure out why my Car/Rigidbody studders on lower fps..
thank you
Hey Guys, I have an empty scene webgl and its bascially like 7mb is there a way i can bring down the size
already using brotli compression
Thanks alot
Hi there! In the editor i can see all of my objects. Exporting to WebGL makes them disappear. How can i fix that? Am i missing something?
Tested with some camera movement. Objects are there but they are all black. Any solution?
I fixed it with re-importing sprites with different name
Hello! I'm working on a WebGL project with Unity.Everything works fine in the Unity editor, but after building to WebGL I get an ERROR when calling the API. do you have any ideas?
you tryin to use sockets in a webgl build?
.NET socket APIs are not supported on WebGL, so you need to go through the browser. There are several websocket transports for Unity. Mirror and Unity Transport would be a few to look at.
been having an issue when trying to download webgl modules, when i go to installation and assign it a folder it says "failed to locate unity.exe"
when i go to unity hub and click "Add modules" under my projects version, it says installed, yet it doesn't show up when I try to build it on webgl
this is my version for my project and the add modules button doesn't show up for it, I'm sure its a simple fix but I cant seem to figure it out (2021.3.16f1)
any help would be highly appreciated
FindObjectOfType and all find functions are pretty slow, so it is better to avoid them in general, unless it is hard to crate refernce.
Let me explain problem you are having:
on Overseer Start you call UpdateHealth from UpdateLevels. This function requires healthText element. BUT this element is assigned on UpdateLevels -> Start() function
healthText = GameObject.Find("HealthAmount").GetComponent<TextMeshProUGUI>();
But if Both Start() runs at the same time, you can have racing condition, as Find is slow and it havent find the element when you Overseer asks for it.
For this you can:
- Quick solution, but ugly. Just replace start with awake on UpdateLevels. as Awake runs first and only then start. so you wil 100% sure that it will run.
- bit longer, but way better practice. Just make references on editor, and dont use Find at all. This will make sure there are no references missing. And make future you more happy when you will need to update code.
- Add if check:
public void UpdateHealth()
{
if (healthText is null)
{
healthText = GameObject.Find("HealthAmount").GetComponent<TextMeshProUGUI>();
}
healthText.text = global.currentHealth.ToString();
healthBar.fillAmount = (float)global.currentHealth / global.maxHealth;
}
Anyways I strongly suggest going with 2) and make you project cleaner and more easility to update in the future.
Does Sprite rendered dont work on iOS webgl?
To my knowledge there's nothing special or platform-dependent about sprite renderers
They're just procedural geometry
If however your sprites have all the exact same sorting depth
https://docs.unity3d.com/Manual/2DSorting.html
then their render order might be effectively randomized on build, causing some sprites to disappear
But that would effect all platforms on the same way doesn't it? as for me it effects only sprites on iOS webgl, but is correct on other platforms. Will try changing render order and check if that will help, thank you.
When someone clicks on my WebGL build it instantly goes to fullscreen. I want to keep it in the small rectangle at the start. is there a way to do this?
use different HTML template. When you build you can select templates. Currently you using Minimal template i guess, but there is Unity one, with button at the bottom to make it full screen. have in mind this is just HTML and Java script stuff.
where do i see templates in build settings?
i found it under resolution and presentation. but the only two options are Default and Minimal.
Default is the one I was talking, you can use that tempalte as example how to make what you want.
Sorry for disturbing, but maybe you will know.
Does iOS webgl support material GPU instancing on webgl Mobile?
From my test Windows -> OK, Android webgl -> OK, iOS webgl -> invisible.
If it is not intended or not known behavior I will create bug report.
I don't know
The browser used to run the application needs to support webgl 2.0, so maybe that's the culprit
I have a simple scene. I've tried to build and run it as webgl but the framerate is significally low, based on the window resolution I get from 45 to 60 frames while in editor i reach 350+
Here's the profile of the running webgl version:
Does anybody knows what could be going wrong?
To be more precise I even tried to build for Windows and in that case I get more than 240fps
So indeed is a specific WebGL issue
Browsers generally force vsync to be on, which limits the FPS to your monitor refresh rate.
Which is 144 😐
generally. not always. especially if have multiple monitors
I use only 1
Hi, in my WebGL Unity project I am using .svg graphics. That is why I had to add Vector Graphics to my project.
Problem is that when I am building project manually graphics looks good and everything is fine. But when it is built by Gitlab pipline and pushed to my server, .svg graphics is deleted and replaced by white squares.
I already add Vector Graphics to .gitlab-ci.yml, but nothing changed.
Any idea how to fix it? Or where I can find solution on my problem please?
Hello,
i have an issue using an UI Button to open an external URL.
It works fine on DesktopPC and Android Mobile. But on iOS Devices nothing happens if i trigger the button.
Does anybody know what here could be the solution?
is there a maximum fixedupdate refresh rate on webGL? i need fixedupdate called every millisecond but for some reason when i build for web it's only called every 16ms.
Browsers generally force vsync to be on, which limits the FPS (and game loop in general) to your monitor refresh rate.
FixedUpdate should run multiple times to catch up, but actually running it frequently might be a problem
hmm... is there anything i can do about that?
Maybe there is some (likely quite involved) hack you could do, but I'm not aware of anything. First challenge would be to have anything in the browser run at that frequency, then seeing if you can somehow take that to Unity.
alright, i'll keep digging.
If this happens to be a kiosk type of thing where you control the machine and not something published in to the wild, you should be able to set a flag to remove the vsync cap on the browser
ahh ok, i can do that yeah.
thanks!
I think is the Problem? Safari Blocks popups by default.
But there Must be an Workaround?
Workaround is create JavaScript to do it for you. And from unity UI just call that javascript.
https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
This way you will have more control. to open in new tab, same tab and etc.
Hello, I hope I'm in the right place. I uploaded the Pachinko project from the Unity Essentials Pathway to Unity Play, but it came out zoomed in. I tried playing with the resolution, resizing the assets, resizing the main camera, but nothing worked well. Could anyone give me an idea what I might have done wrong so I avoid it in my next projects?
What are the webgl build settings for resolution etc?
And could it be your browser is just zoomed in?
At first they were the default settings, I just went and selected webgl in player settings, put in the product name and clicked build. I tried different numbers but to no avail. Right now, on my latest attempt (which made it a bit better) I did 1370 by 600 (I was just fiddling, I know that's a weird resolution) and added a canvas scaler set to "Constant Pixel Size". About my browser being zoomed in, I double checked, it's on 100%. Still, I tried unzooming but the view stays the same.
Try undocking your game window in editor, setting it to free aspect and resizing the window. This allows you to see how your project handles changing aspect ratio and resolution.
Hi,
I'm am making a webgl build where users can select different webcams.
In the editor, I can switch between webcams using key presses and the rawimage will display the correct camera
However in the build, the rawimage will only display the first camera that is detected from webcamTexture.devices
I've tried
- Creating a WebCamTexture() without passing anything - this of course is always the first one
- Creating a WebCamTexture(insert_webcam_name) - always displays the first webcam in the rawimage, however the device name is correct
- Checking for Application.HasUserAuthorization(UserAuthorization.WebCam) before any webcam code gets run - although does seems to be an iOS code only, didn't seem to do anything in webgl. I tried my build in icognito so I can see when camera permission gets asked
- I did print out WebCamTexture.devices.name, and all my webcams gets printed out to the console.
- When switching webcam do webcamTexture.Stop() > assign webcamTexture.deviceName > webCamTexture.Play()
- When switching webcam do webcamTexture.Stop() > Creating a new WebCamTexture(insert_webcam_name) > webCamTexture.Play()
- When switching webcam do webcamTexture.Stop() > Creating a new WebCamTexture(insert_webcam_name) > rawImage.texture = webCamTexture > webCamTexture.Play()
All the above in the editor will properly display the correct webcam. In WebGL it does not.
I am using Unity 2020.3.24f1. Does anyone know how I can select different webcams in webgl build?
Kudos to your effort in writing the question. This is indeed the right way to ask.
`public class WebCamScript : MonoBehaviour
{
private RawImage rawImage;
private WebCamTexture webCamTexture;
private List<WebCamDevice> webCamDevices = new List<WebCamDevice>();
[SerializeField] private RectTransform cam;
void Start()
{
StartCoroutine(RequestAuthroizeWebCam());
}
private IEnumerator RequestAuthroizeWebCam()
{
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
{
WebCamDevice[] devices = WebCamTexture.devices;
Debug.Log($"number of devices is {devices.Length}");
int i = 0;
foreach (var device in devices)
{
webCamDevices.Add(device);
}
InitializeWebCam(webCamDevices[1].name);
}
else
{
}
}
private void InitializeWebCam(string deviceName)
{
rawImage = cam.GetComponent<RawImage>();
webCamTexture = new WebCamTexture(deviceName);
rawImage.texture = webCamTexture;
rawImage.material.mainTexture = webCamTexture;
webCamTexture.Play();
}
private void SelectWebCam(string deviceName)
{
webCamTexture.Stop();
webCamTexture = new WebCamTexture(deviceName); //I've also tried doing webCamTexture.deviceName = deviceName
rawImage.texture = webCamTexture;
rawImage.material.mainTexture = webCamTexture;
webCamTexture.Play();
}
private void Update()
{
if(Input.GetKeyDown(KeyCode.A))
{
Debug.Log("A pressed");
SelectWebCam(webCamDevices[0].name);
}
if(Input.GetKeyDown(KeyCode.B))
{
Debug.Log("B pressed");
SelectWebCam(webCamDevices[1].name);
}
}
}`
Still not resolved yet, but originally I had my webcam code in my current project. So I thought it was possible that something else in the project was messing it up. So I created a new webgl project. Added a rawimage and attached a material. Using the code below, this is working flawlessly in editor, but in webgl build it only sticks with the first camera. What's confusing me is that I am initializing webcamtexture using index 0 camera or index 1 camera, it always displays index 0 camera.
I also thought maybe it was a browser issue so I tried both Chrome and Firefox, but issue still occurs
[EDIT]
I tried a PC build instead of webgl build with the same code. PC build works perfectly fine just like in editor. It's only WebGL. Maybe there's a rule in WebGL that I missed in the documentation?
Not sure. But this may help. Looks like it could be a WebGL issue
https://forum.unity.com/threads/device-camera-in-webgl.523253/
WebGPU is a new Javascript API bringing more featureful access to the GPU while being more idiomatic to JavaScript. WebGPU is now being released in Chrome so websites can start relying on it. This session will describe WebGPU's history, show demos covering various aspects of how WebGPU improves compared to WebGL, the current alternative, and giv...
Well webcam have tons of fun on webgl. There are multiple steps. First, depending on device, you might need to interact with application before you can use camera or mic. Second, before using I suggest to refresh the list, as it might have changed when you interacted with it, so accesing [0] not always will give result you want. These a small tips you might want to look at.
ALSO MAKE SURE YOU USING HTTPS. As without secure connection it will not let you use devices.
Hey, question about 2023 adaptive probes volume. I know it is more performance demanding than legacy probes, but is it still more performant than Real time lights right?
thanks for the tips! I did notice that the first time I enter the app, only the first camera got detected, but everytime after that, it will detect all the cameras. I did print out into the console the list of my cameras so I know which camera is at which index. Also used keypress to change to different cameras at index [0],[1] and [2] but it always stayed at [0].
And yes, I'm using HTTPS! 😄
Hi, i know this isnt specifically of webgl, but i didnt know where to write it, basically my game is using webgl and i have player wepon skins in a database where i can just use one string to storage values, so i separate Texure url, value, weaponType etc.. by a sybol (#), the problem is when i retrive the values i do a Tryparse to convert that strings to the ints and floats, and they dont work, just the strings, if somewone wants i can send screen capture
https://docs.unity3d.com/2022.1/Documentation/Manual/webgl-browser-access-device.html
try these things, and see if it is visible with this correctly
MediaDevices.getUserMedia() and Application.RequestUserAuthorization might be needed to get permisions first
Personally would go with second choice. The first one tested and works without problem, but second one sound pretty nice. also both have documentation which you can folow for your project.
What are my options if I want to play videos in my project that will be hosted on a website?
Webgl have one rule, you cannot play videos normally from other domains. so as long it is on same domain you can just use default media player of unity. if you want to play youtube, then you will need to create your own server which will redirect data from youtube to your game so it would be of same domain. Welcome to CORS hell
so when running my project on my pc it always just looked good, but when i build it in webgl, it is zoomed in for some reason, any ideas why?
fixed it: changed resolution in player settings ^^
Hi there
I'm having trouble to build my WebGL project because of this error
Shader error in 'Universal Render Pipeline/Particles/Unlit': HLSLcc: Bitwise integer instructions are not supported on GLES 2 (on gles)
when chosing Auto Graphics API or just WebGL 1 in the player settings
but when I chose WebGL 2 on purpose, the error disappears, but my regular Lit materials become pink
anyone everhad that kind of error?
Thanks for sharing that link! I have always been able to print out the correct webcam to the console, but it's the RawImage that does not change to the correct webcam. When I first enter the app (using incognito), only the first webcam would get detected, even if I do Application.RequestUserAuthorization(UserAuthorization.WebCam) first. It would be until WebCamTexture.Play() gets hit and then I refresh the page then would all the webcam get detected - However, the rawImage still does not change even though the console prints out the correct webcam. I tried your link and also tried the solution here https://answers.unity.com/questions/909967/getting-a-web-cam-to-play-on-ui-texture-image.html but same result. I'm not sure where to apply MediaDevices.getUserMedia
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
Please have in mind, that on some devices you cannot run Play automaticly, and first user needs to interact at least once with application (when audio is not muted, and on iOS sometimes even when audio muted)
Another common error is when Canvas or Material it self don't get updated. Let me expand about it a bit more. The best if you could test this on your editor, as it is easy to notice by disabling and enabling your UI element that uses webcam texture. Sometimes the UI dont get "dirty" and it thinks that there is no update on texture and does not update it. So in the start it sees it as empty and after that does not automaticly check if texture have actually changed and does not render webcam image. If this is the problem disabling and enabling UI element that Raw imagie is on, will set it dirty in editor and you will see the image. On non editor there are scripts to make it dirty
I'm trying to publish a WebGL game on my site. It was breaking with compression so I'm not compressing it.
https://galahadgaming.com/Games/2023Build/
for some reason it no longer does the Unity Loading screen, it's just a black box until it eventually starts. Also sometimes it doesn't load at all.
Does anyone have experience with this or know what I've done wrong?
hi everione..
one of you guys already found a solution to stream-audio on WebGL?
i want to record microphone but realtime... so i want to captuer streamed microphone to Unity
i got a way to capture 'N' time then send to Unity, but, i want to capture streammed audio to unity and maybe get streammed audio to the page at minimum
that's cool, I didn't know there was a thing called "dirty"! So according to the description on SetDirty "You can use SetDirty when you want to modify an object without creating an undo entry, but still ensure the change is registered and not lost. If the object is part of a Scene, the Scene is marked dirty."
So this could be useful because I am changing the rawimage - and SetDirty could register the change?
I've tried SetDirty, but it seems like it's only an Editor code since an error gets thrown while it's building. Is there another "SetDirty" from a different namespace that I'm missing? And also the namespace us UnityEditor. See SetDirty_Error.png as an example
I've also attached a screenshot of the inspector for my raw image and material. I think I've set them up correctly. See RawImage.png.
I was also paranoid it was an Unity version issue so I tried 2020.3.48f1, and the same issue occurs (I'm on 2020.3.24f1)
if you changing unity versions change to 2022. It have quite a lot WebGL improvements and bug fixes. I think 2022.2.13 at least should be target, or any newer. There are Editor set dirty and runtime. you need to set dirty only your rawimage element.
RawImage myRawImage;
myRawImage.SetAllDirty();
Have you tried it on editor? does it work?
change your webgl build template. your html page is minimal. use default if you want loading screen. or implement your self as in example
I was changing unity versions just to see what happens, but I'll try your suggestion with 2022
But in Unity 2020. I tried SetAllDirty before WebTexture.Play(), and still doesn't work in webgl build haha. This is such a mystery 🕵️ . See SetAllDirtyBeforePlay.png
In Editor, switching webcam has always been working with or without SetAllDirty
WebCam.mp4 is an example of the webgl build. I am pressing "A", "B", "C" to switch cameras. You can see no matter which one I select, the rawimage displays the same camera but from the text you can see the camera is detected.
oh wow, 2022.2.20 works perfectly in webgl build. Thanks to all that had replied and helped!
please have in mind that it might return, so you need to set dirty AFTER Play(). And also As I mentioned before dont use Editor set dirty, but use Image elements set all dirty. But anyways, I am happy it works now, 2022 is better for webgl anyways.
my webgl build works, but the first time the player clicks the game goes fullscreen. i do not want this event to happen.
trying to research and i keep finding articles with fixes saying the same thing
I removed "(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf("Safari")==-1||s>=10.1)?1:0" from the "hasFullscreen:function()".
B E F O R E :
hasFullscreen:function(){var e=document.createElement("canvas");return(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf("Safari")==-1||s>=10.1)?1:0}
A F T E R :
hasFullscreen:function(){var e=document.createElement("canvas");return}
But I can't find any file called UnityLoader.js in the build directory. Any thoughts?
I only want my game to exist in the small starting webGL window
All I need is to stop the game from going full screen when it gets clicked on, it looks perfect once I press the escape key
In Resolution and Presentation I have selected
width = 960
height = 600
Run In Background: unchecked
webgl Template: default (only 2 options are default and minimal, I don't like how minimal looks)
I see under Player>Resolution and Presentation
there is an option to switch from full screen to windowed
but that is for a Windows/Mac/Linux build, not a WebGL build
https://docs.unity3d.com/Manual/webgl-templates.html
Just edit your template or create your own template and remove "full screen" button.
Also you kidna always want to have run in background check.
ok another webgl error on 1st attempt on browser
I've been set such configuration on about:config according to the tutorial
also set the compression to disable, but still it remains error on mozilla
*my build runs decent at itch .io
let me know if you guys notice this
thanks in advance
you should load project from a host in your machine, use Xamp, Wamp, or something, then add into a folder on your localhost
It's not the full screen button that is an issue, its that the first click anywhere on the game turns it fullscreen
This is intended behaviour
WebGL builds are not standalone applications
Should I be worried about my game not using any compression method?
gzip is giving me weird errors
Unable to parse Build/Build.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug.```
Depends on build size and how much you care about some % of users leaving before the game finishes loading.
The error is pretty common and pretty likely to be accurate.
Hey guys maybe someone can help me here, I have a WEBGL project where I use Unity Multiplay API'S to allocate servers. The problem is that my API response is getting blocked by CORs.
I disabled CORs on my browser and it worked fine, how can I setup custom headers on the Unity multiplay servers?
i made a small game where i save data to 2 different textfiles, put if i build it as webgl, only data gets written to one of the textfiles and the other is always empty for some reason. Any ideas?
you cant save textfiles on webgl.
just can't.
makes sense honestly
but i dont understand why certain data does get through
to the other scene
if game object is not destroyed, for example is DDOL, it will transfer to other scenes without problems.
but the way it works its like, they save it all to textfile on one scene, and load them back in in the other scene
but that shouldnt work
but it works
or it is scriptable object, it will also get transferred to other scenes. but reseted on game reload.
you write to file in a singleton? DDOL manager of some kind?
i just write to a txt
it most likely load data from reference of previous writing. Or load default data that you had on build.
from a static class
static class also dont get their data deleted on scene transfers
tho I might be wrong on this one.
i did try that
because not all data got transfered
so i saved in a static list
but that didnt switch through
but ill just hardcode the data for now and ill let the next person fix the problem
why you use text files? you want to continue from wheere you started when start game again? aka save file?
no no
only in the same session
i want it saved
different session different data
Use scriptable objects or DDOL.
or unity have extra feature for that as well called (let me google it)
User preferences I think
could be i have heared that before
pretty much
I've been through this a year ago, but I'm totally forget about it
do you solve it ?
yeah, it was something wrong with the server im hosting the website/game implementation on
Do you guys recon it's a good idea to use firebase for authentication on the website where I will be hosting my game?
Can anyone assist me how do i setup a websocket for my game
My unity game is WebGL based but it wont let me connect because of websocket
Also let me note my game is multiplayer
why are you using firebase ?
I thought you're game is webgl
I mean there's plenty of webgl hosts out there
or do you need some login/registration system ?
how about to play it on localhost browser ?
@dull quest can you assist me
does it with photon ?
its with webgl and websockets
duddeeee are you change ur name ?
?
no
this is my name for like a few months
what does my name have to do with anything
I recall ur pic, read my dm pls
alrighty hold up
Anyone have any success interfacing with Wix?
Looking for help fetching a product dtabase
hey, ive been using unity 2020 for a while. i'm planning to make a simple point and click webgl game.
i've been primary making games on Steam, but kinda new when it comes to making webgl games.
i'm curious if there's any advantages to using unity 2021 / 2022 for webgl specificly, if its stable or more broken than 2020. any thoughts?
When i build with webgl I dont get an index file anyone know why
What do you get in the build folder?
build and template data
I get soem errors as well
i got it working and uploaded it to itch.io but when i try to open the game i get stuck on this
Check browser's console for additional details. Note that Itch.io only supports gzip or no compression.
Can I take payments with my HTML5 game?
Currently all HTML5 games on itch.io are set up to only take payments as donations. However, it’s possible to sell access to your game by setting its “Kind of Game” to “Downloadable”. If you'd like itch.io to support purchasable HTML5 games then you should get in touch.
Thank you so much
ok so i am trying to build my unity game into a webgl or html but when i open it from my file explorer i get an error saying something like "both async and sync fetching of the wasm failed" or something and then the game won't load, how do i fix this
I believe you could embed ads or add IAPs. If you want to do a more serious release, I would recommend hosting on your own site and uploading iframes to various web game portals.
yeah I need that
It's alright I got it mostly sorted
Though I have a question about WebGL: Can I use the job system if my game is going to be in WebGL?
Howdy, new here and just getting started with integrating my apps with a site. Looking for help with retrieving a product list from my site. I already setup the function and the database but when I make a webrequest from my app I get error 404. Are there any unity specific examples or resources available or can anyone help?
My end goal is to select a product and launch a 3d model viewer for the selected model. Not sure how I should be going about persisting the selected product name so that the model viewer (embedded webgl unity app) can fetch the product name and load the correct model.
I believe Jobs will gracefully fallback to single threaded. Are you targeting multiple platforms? Keep in mind that those workloads across 8 threads can end up being problematic when that same workload runs on a single thread.
Anyone know a solution to this issue. The virtual keyboard opens but it does accept input on mobile. I’m using 2022.1.23f
Edit: Solution -> #🌐┃web message
Could you expand on what you mean?
I had an issue like this so I just placed a button over the input field and in the onclick I dropped in InputField.ActivateInputField
This was a VR issue though. But you could put in a dummy button to test to see if tha is the issue
just set it active using the button and see what happens
I'll give that a try. I'll hook into the onselect event
do you solve it ?
Okay figured out how to make it work. This is attached to the gameobject with the TMP Input Field.
When the field is selected it opens the keyboard and updates the input field text in a coroutine.
public class UIInput : MonoBehaviour, ISelectHandler
{
[SerializeField]
private TouchScreenKeyboardType _keyboardType = TouchScreenKeyboardType.Default;
private TMP_InputField _input;
public void OnSelect(BaseEventData eventData)
{
if (!TouchScreenKeyboard.isSupported) return;
var keyboard = TouchScreenKeyboard.Open(_input.text, _keyboardType);
StartCoroutine(GatherInput());
IEnumerator GatherInput()
{
yield return null;
while (keyboard.active && _input.isFocused)
{
yield return null;
_input.text = keyboard.text;
}
}
}
private void Awake()
{
_input = GetComponent<TMP_InputField>();
}
}
is LINQ supported in webGL builds? Doesnt seem that Distinct() likes them very much.
yeah I just changed the screen size in the edit page of the game
I’m not sure what you mean
What part's unclear?
I mean, I still don’t know if Jobs can be used on WebGL or not haha
Going by what Danny said yes
But you'd lose the optimization benefits
How come?
Jobs is efficient because the code runs on multiple processor threads
If WebGL can't support it, it'll fall back to just the one primary processor thread
Ahh right
Yeah online it says webgl is single threaded
But that was in 2018
It looks like in 2020 there was a way to enable multi threading but it was still being developed
Idk I’m just worried about pursuing making my game on the browser in case it is super slow
I really wanna make it through webgl but online I’m seeing a lot of people advising against using unity for webgl games
You can do webgl games perfectly well, but you have to be more vigilant when optimizing it and keep track of webgl specific limitations
Where can I find those limitations?
I just wanna make sure that I can actually use WebGL for my game, since it’s my uni project for my last year
I don't know if there's a comprehensive list so you'll need to do some research and profiling but these are helpful
https://docs.unity3d.com/Manual/webgl-performance.html
https://docs.unity3d.com/Manual/webgl-graphics.html
The WebGL chapter of the manual is worth reading in its entirety
alright thank you!
what version of Unity you are using ?
2021 something idk
Does unity webGL support compute shaders?
Online I find conflicting information
Thanks in advance guys
Anyone here using WIX or squarespace to host there apps? or is everyone using itch?
I would look into something like Netlify (distributed web server) + Cloudflare (free unlimited CDN traffic). Cloudflare's static website hosting might be able to replace Netlify entirely.
Anyone have any ideas how I can stream live into my WebGl 3D site via my Rokoko mocap suit and Unity? I am using a mirror server setup...
Probably a niche question but does anybody knows a plugin/script that is able to do lipsync at runtime by listening the audiosource?
Every plugin I tried didn't worked on WEBGL
I ran into a problem with WebGL and Addressables. When I load an asset, the shaders don't get initialized somehow? The objects and materials are all there, but they are invisible. When I switch to other platforms, this does not happen.
OVR lipsync and AWS Polly are some options ig. My friend recently told me about it.
as far as I know OVR is not supported for WEBGL
while polly ha no runtime option, it just outputs a viseme list with timestamps
I dont know. I have this impression that webgl is not that optimised and advanced for development on to go for webXR. I usually end up using tools other than Unity.
A-Frame, Needle Engine, Threejs, etc
Hm thanks. That doesn't seem to be my problem. I load the addressables from a server. Everything is loaded correctly. The shaders are assigned. They just don't show up.
its not for XR, i just hte lipsync part
I need understand how I can manage an audio track on WebGL
Basically the sites that host also the webapp I'm building on Unity at a certain times emits an audiotrack
Now is it possible to receive it inside the unity app at runtime and play it through the audiosource instead?
There are voice chat plugins that transfer voice data over JS websockets and convert it into an audio clip, so at least that stuff should be viable.
Any idea of what I should look for? Web stuff its really obscure to me
But at least I got lipsync at run time on webgl working
so I only need this last part where the backend of the website gets the synthetized speech audio from an api and send it to the unity app that plays it
What do you use for lipsync in WebGL?
a version of SALSA specifically made for WebGL, above everything I found so far is the only one that still works
I never got Salsa to work in WebGL properly. The lip movement was way too random.
It kinda is because you have just a normalized value to decide which viseme show but its still better than 0 tbh
Any good ways to make MQTT work in WebGL?
Got a question for those that have done so already: I have created my project ready for webgl and I'm going to put it onto my website that will act as a portfolio. What's the difference between using an embed of the project and just hosting it on the website?
It's just a preference, no difference in performance or anything if that's what you mean.
All depends on how your portfolio website is setup. If there isn't enough room on your website to embed it then just provide a hyperlink that opens the WebGL project on a separate tab / page.
I plan the whole website around it, havent made it yet but It will be the level on the frontpage and then other tabs such as contact and dev blog
any help?
- open browser console f12 and see actuall error instead of this.
- does your editor have ANY red errors on testing?
- Build developer build and enable full stack logs in Player build settings.
- inspect the logs.
If these wont give you answer, then write answers to these questions and others might help. currently we cant
I'm still trying to figure out how get text-to-speech audio from Amazon Polly in unity WebGL at runtime and still getting errors.
Here's the code I use: https://hatebin.com/klhdbrqkmj
It works fine in editor but once on web build I get error, at the line where the '//(!)' is
I get the 'filestream null' issue could this be caused by the WEB build not be able to have multiple threads?
Webgl only from 2022LTS have support for C++ multithreads. C# multithreads are not supported. so anything multithreaded will not work.
UniTask does nice thing for you, you can write multithreading code (so it is a bit easier to transition from your current code), but it will run on single thread on webgl anyways without causing errors.
In short you out of luck 🙂
But code you posted have no multithreading. Tho I am pretty sure you cant write to file on webgl either. Aka you dont have any local storage, only memory. So it works bit differently
Ok so its not linked to that thread issue... anyway do you think that switching to 2022LTS will increase the performances by a bit?
Cause for now I have a very good pc and get around 60 frames while on editor is 200+, I know that performances on browser are limited by it but on low end pc it runs bad even if its just a 3d model on a blank scene
2022LTS does not differt alot from other 2022. but it have nice features if you go from preivous versions. I would say a must update.
BUT: 60fps is most likely because you are having 60hz monitor, as browsers by default limits your frame rate to your monitor refresh rate. So you cannot run webgl faster than 60 even with monster PC.
But if it goes to lower than 30 I would be worried about optimisations. Are you running URP rendering pipeline? there are quite a lot of quality settings you could play with. Also Unity profiler is very handy, it is bit difficult to run it on webgl, but possible.
I'm using a 360Hz monitor and get 60fps while on low end pc I get 20fps so I don't think its a refresh rate issue.
I'm using urp, about the optimization I tried to use profiler but most of chunk was made by a section called "Other" that wasnt clear about the thinks that were processing
Low end device you mean by?
It is bit hard to tell without seeing project. Maybe you just expect too much from webgl? Like using Realtime lighting everywhere, hight shadows quality and etc. Or maybe you running into memory problems? Or maybe CPU is bottle neck. Tho if editor is running at 200, 60 fps is pretty good..... as you looking at about 4 times lower performance on webgl than pc 😄
with low end pc i mean an ordinary 300-400$ laptop
It is really hard to tell I am sorry. I would need to see to say anything else. But it is very common on webgl to run like shit. For example in our project we have Streaming video feature, on editor you can stream high rez videos with 200+ fps without problem, same pc on webgl and video streaming on? barely 60 fps. So things like video encoding on webgl is horrible.
but it might not apply to your project at all
I'm trying to integrate the unity web build on the site but I got this errors, any idea of what causes them? Is it on the site end or on the unity app end?
actually where can I see how host a webgl game on a website? Look like after 2020 unity changed they way its webapp must be handled
Yes I am building an app I like to make beer money off of, I second the question above. I'm not sure if steam supports it
I never used WebGL deploy,so I cannot help. You can deploy it manually on any webserver without that plugin.
https://docs.unity3d.com/2022.1/Documentation/Manual/webgl-deploying.html
you jsut need cofig server a bit and then put your game build into your webserver directory on server. thats it.
steam app on webgl? 😄 cute
Hi there! i'm trying to take a screen shot in game and download it as an image, and i'm having a "overload resolution failed" error.
I'm doing it with a JS api
public async void Screenshot()
{
Texture2D tex = await GetComponent<Camera>().TakeScreenshot();
string base64 = Convert.ToBase64String(tex.EncodeToJPG());
Api.DownloadImage(base64, "Screenshot");
}```
And API side (tw: not c#)
```js
window.odyssiApi.downloadImage = function(base64Image,fileName) {
const aElement = document.createElement('a');
aElement.setAttribute('download', fileName);
const href = URL.createObjectURL(base64Image);
aElement.href = href;
aElement.setAttribute('target', '_blank');
aElement.click();
URL.revokeObjectURL(href);
}```
My hypothesis is that the base64 string is broken somewhere, and idk where/why/how to solve it
when building with the defailt windows thing my project builds fine but when i try to publish or build it with webgl it gives me the error in the attached image
I am facing a webgl memory issue so I built a empty project from Unity 2022.3.0f1, it run well on local but wen I upload it to s3, the JS Memory take too much memory, anyone know the reason?
it also happens on local when I try to reload the page several times, when I develop the game to Facebook webinstant, in some low devices, players can't event load the game (stuck at 90%), I think they are out of memory then make the browers crash.\
@barren pollen
Does any one know about this problems? I have no ideal about this.
how about other platform such as itch io ?
It's not a problem, it's actually normal. Unity WebGL has something called Heap which is a block of memory managed automatically. It can grow up to 2GB based on a game's memory requirements over time. So yes, unfortunately some lower-end devices may crash if they run out of memory.
I think due to the limitations of the web, this is why some devs may stay away from it or give up on making game for WebGL. I personally enjoy the limitations because it forces me to be more creative with minimal resources.
Thank you! Btw I have an error when set the exeption support to none. The game works well again when I set it back to withoutFullStacktrace. Do you know how to fix it?
Did you have any exceptions in the console before setting it to none?
Thnak you! I think so
@sweet oriole the only red log that I have is
does it effect to the exeption support?
Anyone tried to generate a pdf with info and screenshots from unity webgl? I searched a bit on the internet but couldn't find any definitive answer.
I wrote sample code.
https://github.com/gtk2k/Unity_WebGL_Dwonload_CamShot
I not use API (base64)
for this one, I just figured out that some addressable function throw exception in Webgl. Do we have any document/tip for using addressable in Webgl?
It's supposed to pretty much just work. Not aware of any platform specific Addressables documentation
can sb help me with my webgl built? i have it online and i get 2 errors on loading. should i post the errors or the link to my build in order to see for yourself?
This is the site https://vaggelischristopoulos.eu/PolarWebTest/index.html
What's the easiest way to get an MP3 from a website backend where my WebGL game is?
I read that the backend should convert the mp3 into an array of bytes, then into a string and then send it via the SendMessage.
Does exist a more simple way?
(No I can't use a webrequest to a link since this MP3 gets generated at runtime and its always different so I guess can't be hosted into a link)
Hi ya, trying to get a web gl built, I have 8 errors.... not sure why.
Tried changing the build location to another drive and worked fine 🤷♂️
Hey guys,
Quick question.
Since computebuffers are not supported for WebGL can I use a graphicsBuffer (as second vertex buffer maybe?) and send some data over in buffer format that way?
Thanks guys
https://forum.unity.com/threads/waitforcompletion-exception-in-webgl-for-addressables-1-18-15.1152719/
The bad thing that I don't even see the exception in the browser console.
https://hatebin.com/uaifbmpagy
This is the code I use to receive an mp3 that was previously converted into an array of bytes and then into a string to be able to enter in a SendMessage()
It works like a charm on unity editor but doesnt work on WebGL, probably due to the limitation to not be able to use 'Application.persistentDataPath' and other local memory related things once hosted on website.
Can somebody help me out figuring out if its possible to convert it?
I think you gotta use WWW
isnt www the deprecated version of webrequest?
I initially used it on editor and got a warning from unity that suggested to switch
haven't tried www on webgl build tho
Might be, not sure. Just remember using it instead of the persistant path
but didnt webrequest require a link?
Sorry I've never used webgl before, can you explain better?
The persistant data path is a link, since your files are hosted online (;