#🌐┃web
1 messages · Page 5 of 1
I'm sure you looked into this option, but my guess on that error is the device ran out of memory.
Well yes, it ran out of memory, but why does it only occour on that device, and it also happens quite often on that device, but non other
can anyone help me, when i build webgl and open the index.html file, it would say an error. How do i solve this? I use 2021.3
Opening the index file doesn't work for webgl, it needs to be on a server. Easiest way to do that is just by doing build and run and it will automatically open unitys simple web server.
ok, but how to open it subsequently or share it with others?
To share it you will need to put it up on an actual website. If you want to reopen the simple web server for testing you can find the exe (don't remember the path off the top of my head but just Google it) and run it in cmd with a parameter of the location of your build.
For sharing something like itch.io is an easy free way to put it online.
Thanks, i would try it like this
Gl
has anyone here ever tried implementing voice chat with webgl?
Does somebody know where can I get a WebGL responsive template for latest unity versions? (2022.3)
I'm struggling a bit, when resize the broswer that it changes the camera fov
Hey everyone. We are having an issue where, we have a Database on a server and we Query it with Unity WebGl through HTTP requests (not HTTPS) to get the table associated with our computer name. This used to work in unity 2020 but since we updated to unity 2022 it stopped working. I noticed there is a new setting in player settings called allow HTTP requests and we have this set to always allow. Any idea what might be causing this? Anyone can help? Thanks 🙂
Is urp SSAO not working in WebGL?
Simply they defaulted Unity to accept only HTTPS for security, but as you have done, you can change it in the settings, or, you can use a proxy server to pass through the data: Client - HTTPS proxy - HTTP MyServer
do you have a screenshot of your game / experience? what's your goal?
what is the game / experience?
Building an mmo rpg, managed to get the voice chat working though using Agora, its cross platform too which is great and has spatial audio
do you have a screenshot handy?
Screenshot of what?
yea you can actually visit it at https://normies.ai, although we're in version like 0.0.0.0.1 lmao
Player sprite looks pretty awful we're working on a paper doll/player customization system at the moment so it'll be updated soon.
An mmo, we don't have too clear of a vision of what the finished game will look like, one of the bigger things we're trying to do is add JEPA automous agents to the game.
this is a school project?
If you make an account you'll be given a plot flag that you can place down to claim territory and you can place the campfires and sleeping bags in your inv
Nope, this is a company haha
startup to be more specific
We're trying to implement autonomous agents based off this paper: https://arxiv.org/abs/2304.03442
Believable proxies of human behavior can empower interactive applications ranging from immersive environments to rehearsal spaces for interpersonal communication to prototyping tools. In this paper, we introduce generative agents--computational software agents that simulate believable human behavior. Generative agents wake up, cook breakfast, an...
do you have more than $25k of funding?
Far more haha, but the investments "we've" (I put quotes because im an employee) gotten aren't focused on the game but their investing primarily in 2 other products of ours which aren't related to gaming.
i keep peeling, and i'm discovering this is an onion, not a banana
lmaoo
i make unity games and services, i also author a lot of unity webgl engineering content. maybe instead of "what is your goal?", what are some of the promises you guys have made
We haven't made any promises yet as the game hasn't even been announced yet haha. But I think saying mmo rpg sums up what we're attempting quite concisely, there'l be crafting, a skill system, potions, iron smithing, dungeons, etc.
gotchya
Also generative AI, so on top of the autonomous agents most npcs will have elevenlabs type tts and can speak directly to you based off your circumstances, rather than generic dialogue which you would normally find and isn't tailored to specific players
are you in charge of all aspects of this game?
in practice?
promises can mean, to stakeholders besides players
Yea I'm the lead designer and programmer at the moment, we might hire an intern or possibly full time person soon though.
cool
i am reacting to how much stuff is going on
which is good, that i see, a lot
what is your personal goal then?
like is it to make a game people like to play lol
is that the goal?
Yea the primary goal at the moment is a game many people would play, it's meant to be an mmo, we're hoping to eventually get 100k mau
bw if you're looking for a job let me know and send me some of your content, I'd probably recommend you if it's good, there's a good chance you might know who my boss/one of the cofounders is, I rather not say in this public discord though.
btw*
Do you see any errors in the developer console? Could be a mixed content error if the webgl itself is served on an https server
Hi everyone, having a WebGL build issue here I was hoping someone could help with.
Our project has initially been developed for VR, and is being converted to also support WebGL builds. I have followed the steps to get past the majority of issues with this (namely Oculus Integration Assembly Definitions and direct references to the Oculus package). I now have WebGL building and deploying to Unity's LocalServer.
However, as the build gets about 95% of the way loaded, I get a long error / stacktrace that culminates with: "Object.removeRunDependency" somewhere in my WebGLBuild.loader.js file.
TypeError: window.OnUnityLogMessage is not a function is also appearing
Update: the issue seemed to be caused by a package that we have in the project sending messages at startup. Resolved for now
do you have a screenshot or link of your game? what is it
Do somebody knows if its possbile to initialize an embedded webgl in first place and only after pressing a button to actually boot it up and play?
What's the difference between initializing and booting up?
more that inizitialize i meant load. do you know when u load the the page and there is a loading bar? I want to keep at on start but "boot" the game not only when the bat has finished but when I want it
for example press a button "start" that i make on the frontent
Can't you just make the button in the game?
If you really want to do it outside Unity, edit the page CSS so that the game container is hidden by default and add a HTML button that shows the container
why not utilize routing of an SPA to point to an Init endpoint that contains a button, and let the button route to the webgl game endpoint
its giving be this error?
Unable to parse Build/online game.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.
What gives you the error?
Also, did you try disabling compression in the build setting?
so i did try disabeling compresion but i cant upload files larger then 25mb to github and the ucompressed file is 26mb, which is also a test run too see if i can even get it too work so im thinking the completed project will be much more
Which file is 26 mb?
Afaik the size limitation is per file, not the whole project.
ye, its per file my bad
Is gym app the name of your project?
Do you need to do this on Github Pages? 😛
yep
ye kinda, ik i can use itch, but i want it so when u open the link its just the project shown and nothing else
I wouldn't use Itch either, but something like Netlify.
so i just had the idea of just grabing the link to what itch displayes and i now have a link to just the game and nothing else
i got it from inspect element
but now its giving me a ugly link, so i could teoretically just input the same src to a html run by github with the actually link that i want
so the issue is techinically fixed tnx guys
My mouse clicks are coming in...for lack of a better word, slowly when playing my webgl game in Safari
I have to hold the mouse down for around half a second for it to register
interestingly, if I mash the mouse rapidly, it eventually registers a click
Works fine in Chrome (on macOS)
Keyboard input is fine, so it's just clicks. I wonder if the browser is trying to do something clever (and failing)
Who makes 3D URP Webgl games? How to optimize the game properly?
that's a very broad question. have you figured out what's bottlenecking you?
Hi, having an issue with URP and WebGL builds on 2021.3.4f1. Anything using the URP Lit shader is invisible in build. Have tried a couple of fixes I've seen online (removing receive shadows from the material, setting surface type to transparent, regenerating shader includes) but nothing works. Any advice?
I would probably upgrade to the latest patch version of 2021.3.31f1. Did you try in a clean scene with a static camera and a few rendered objects?
Doing a desktop build can be helpful to narrow things down
do you have a game or planning to make one?
do you have a screenshot of what it's supposed to look like, and a screenshot of how it looks now?
I have a game
do you have any shots from the editor?
it will help communicate what you have
just the character and the box
I have 500+ fps in unity.
in the browser 140
in browser on mobile 40-50 fps
I can not figure out why on a cell phone in an empty scene slows down and drops fps
Hello hello, I'm having and issue with my webGL build on itchio, the game runs the made with unity spalsh screen, but right after that, I receive this pop-up, does anyone knows anything about it? 🤔
I generally assume it's something affected by things mentioned here with these kinds of errors https://docs.unity3d.com/Manual/ScriptingRestrictions.html
You might get more useful information in development builds
do you have a screenshot of your game?
Yooo thanks for replying, it's fixed already, I had a confusion selecting which scenes to build 😅
@plain shard
huh don't ping me??
no i will
Why are you talking about these things here?
because that was really unfair
!mute 893147990359957524 1d no you won't
gamedev_uv was muted.
thank you
!mute 778947882086432790 no you won't
i really appreciate that
deliciousbrownies was muted.
!unmute 893147990359957524
gamedev_uv was unmuted.
@cold frost sorry wrong id lol
nah np
He joined the other server and spammed the same message like 10 times i kicked him out
He rejoined did the same shit again

Hello. I have a Unity scene added to my Blazor WASM (Single Page App). When the user goes to the page with Unity, it works fine. But, when they leave the page I get an error, which repeats until the browser crashes: TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
at _JS_DOM_MapViewportCoordinateToElementLocalCoordinate (https://localhost:7201/Build/Build/Build.framework.js:3:27093) Anyone know how to prevent this?
Does anyone know a free package or other way to create a file picker on WebGL?
Thanks. Yes, I switched to 2023.2.0a10 and it resolved the issue. I also had to implement a way to dispose of the JS library when the user navigates away from the page. hopefully it gets fixed in new updates
So, I can't build any WebGL project, it just create a new empty folder. Can anyone help me (there's 10 to 15 errors in the console when I try)
I was just following the Unity pathway to learn and I'm stuck bescause of this error
Showing the errors would be a nice start.
Oh, sorry
All the errors are similar, they tell me that there is "no module named '_ctypes'" but in another path with another script
And the console write "[Version and build] Build failed! 00:00:15.4654959
I use a Debian 10 OS and Unity 2022.3.11f1 with the WebGL module
This forum post suggests that re-installing Python might work: https://forum.unity.com/threads/webgl-build-fails-on-ubuntu-20.1490716/
It don't work but it's definitely an error with Python
Hello everyone!
I've been struggling for so long with the Cross-Origin Resource Sharing (CORS) issue when making requests to APIs using UnityWebRequest in WebGL applications running in the browser. I've researched and tried various solutions, but they all seem to introduce layers of complexity I'd rather avoid.
Has anyone tackled and resolved this issue in a way that could be considered "elegant", "simple", or even "ingenious"? Any advice or experiences you could share would be greatly appreciated.
Thanks in advance!
There's only one reasonable solution, depending on whether you control the API or not. If you do control the API, add the correct CORS headers to its responses. If you don't, you need to make a proxy server between the API and the game.
I was trying to avoid having to use one of those two ways to solve the problem. So there's no hope beyond those options...? 🥹
It's a security feature. If there was an easy way to get around it, it wouldn't be a very good one
That makes sense, thanks. Any good advice about the proxy way to solve this thing?
It should be relatively straightforward depending on the API. There should be plenty of resources online
thanks, I will try my best 👍
do you have a screenshot of your game?
it will help me understand where you are on your journey
I'm not making exactly a "game". I'm full experimental mode creating a lot of concept apps and experiments using AI models, but I want to run them in browser connected to APIs, and here is where I have the problem 😅
https://twitter.com/ilumine_ai/status/1678394578854969344
here are some interactive samples:
https://huggingface.co/ilumine-AI
are you fal.ai
no, but I've been trying to find a solution with them (still talking)
can you visit https://appmana.com/watch/virtualtestdrive and click drive and drive the car around? and try it on your phone too? do you know what you're looking at, technology wise?
An AppMana Streaming Experience
what is this for?
this is to avoid using webgl entirely. you "just" have a streamed machine, but it's very powerful, but it's not a VM, it's not virtual desktop, it's not furioos, it works on mobile, it loads instantly, etc. etc.
so if you need to call an api, it Just Works. indeed you can use however much memory you want, you can even run models locally, if you choose, straight out of e.g. a comfyui workflow, for example, which i maintain
does this sound interesting to you?
I think this goes beyond my needs right now 😅
might make your life easier your demos look nice
perhaps if you had to deal with less webgl crap and could just push to git you will have more time to do cool things
I'm good for now with webgl, I just need those web requests working in my projects 😶
does anyone has performance issues with firefox? my game run smoothly on chrome (60fps) but on firefox I have like 20, I checked hardware acceleration and it's enabled, both browsers are on latest release
edit: turns out using a video player, even with a 640x480 resolution has infamous bad performances, does anyone has an alternative to use?
do you have a screenshot of your game? what are you trying to do? using a jslib to play a video can be done
well I have a video player and a render texture the video is rendered to, which is applied to an arcade prefab
that’s not fancy but it gets horrible performances on firefox, it was taking like 74% of the resource for one frame
We've no multithread support, right? Trying to parse like 5 dictionaries worth of words (chopping them into multiple different substrings), so anything to improve loading times.
what about compute shader? Maybe I can work with that.
The solution is complicated. What is the game? Are you trying to make a trie?
just some word game where you're presented with substrings to construct words out of
I suppose you can ticket Unity. It really depends if you want a workaround or a solution.
What is the data structure you are trying to make?
Not the one you start with. I get that you start with lists. What is the data structure you are turning word lists into?
Or is the answer “none”?
And the word lists, how do they get into your game? Are they in your Assets/ directory? Are they downloaded from the web at runtime into your game?
Because no you don’t have multithreading. You shouldn’t be parsing at runtime.
Ah, ok yeah it's been a while but I've it parsed already from some python script my mate made
Answer my questions though
I think the problem is object construction from reading it in from json
Try to reply to the questions specifically @outer wave
I'm using streaming asset folder for webgl
Okay
actually need to fix that now cause betterassetstreaming api doesn't work with webgl apparently
Can you reply to the data structure question
This is a bad idea. It provides no advantages. The long delays you’re observing come from many factors, a significant one comes from using StreamingAssets
Stay focused on my data structure question
sec trying to navigate what I was doing lmao
I don't think that would be useful. I spent hours and hours for an issue about 3D audio with a video player and its audio source. Turns out it's a bug from unity, it plays it full blast at center, but if I sync a separate audio and video component manually, 3D audio works. Sent it to the unity bug tracker, they said they can reproduce it, and after a while, "Won't fix"
what a joke
nah, it works fine. Just ive left with loading issues which are apparently on webgl but not android
I’m said it was okay
and I think it's because of the streaming asset like you're saying
I wish I would have tried cocos or godot before buying assets and stuff.
And I’ve made word games, typically you store the word lists in a data structure, like a trie, that is useful for these sorts of games
Or maybe it’s a Dictionary
There’s a big difference
Yeah, I actually started with parsing because these dictionaries are like many mbs in size
Or it’s a List
but im looking at it now and I just chop it up ahead of time
You’re saying dictionaries, and they’re word lists right?
right
Okay but if you have text word lists that are just smaller files
So the answer is a mess right?
Like what’s the data structure in memory in C# these get turned into?
You can’t solve this problem without the answer to that question
You can try and figure that out eventually. It can be a long journey or a short one
Sorry I’m not trying to be annoying
But ultimately to make it load fast, you will have to put, in your Assets folder, a binary file that is the in memory representation of the data structure you need. Then you can load it directly without parsing.
You haven’t done any profiling so you’re just spitballing. But if you do, it will be loading the files and the parsing that will be incredibly slow
They are just as slow on Android, it’s just that the StreamingAssets folder is already there, and I don’t know how you do the parsing, it may be non blocking
he could make a small C++ program to load like a .csv or .json file and convert it to binary, and then load it directly, that would be convenient for updating its structure whenever he likes
I think it’s going to be one of those blub solutions. He may have blocked me. I’ve done a WebGL word game so I’ve gone on this exact journey
what? why did he blocked you
Dunno
what

I'm looking at the streaming asset folder stuff
https://github.com/gwiazdorrr/BetterStreamingAssets
I use this for android with no problems but it doesn't support webgl so I was just using the general streamingasset method
Just trying to figure out where I left off here with webgl, but I know that async methods werent working
Okay but forget about that
Please try to answer my question
Are you saying you just have List<string>?
It's Json into a list that's it
list of structs with the strings
OKAY
Can you show this struct?
I mean show the code
List of structs
Like literally the field and the struct so that it’s unambiguous
Okay well everything in this file is going to be slow
Especially in WebGL
Zip, parsing, big memory allocations
Downloading
And all at runtime
So you’ll have to rewrite it
right it's that I made it for android and thought webgl was light enough to port it over
But I’m glad you shared it
but apparently can't use a lot of my async methods or apis
You can read my pinned tips and tricks on WebGL on the forums for more info
Well do you want to rewrite it?
probably will look into it as it would be nice to port it over
Do you understand what I mean by “representation in memory”?
You will do textasset.bytes
Then those bytes go into the constructor of an object that is like “WordListStorage”
And its methods are whatever you need to query, and it does O(1) arithmetic on the bytes to get the strings or whatever
No transformations at runtime
it's not the cleanest in general even for android, but I can see what I was trying to do the last time I picked up on this
Try to model the end result of the parsing that you need for your game as a single instance of a class
but I've actually experimented with some other general ideas and yeah, it's down to a memory issue here
Then you can read online how to model the individual parts of it from a span of bytes
Hello. Can anyone help me with this
Implement a robust communication layer that can handle large files by segmenting them into smaller ones and reassembling them on the receiving side
why are you downloading asset bundle files through firebase?
also, are you aware of the limitations with loading assetbundles in webgl?
also, what do you mean by memory leak?
do you have a screenshot of the game?
hey all
does anyone know how these errors could be fixed? i tried searching online but none of the solutions that mentioned the same errors worked (tried rebuilding all assets, tried deleting the asset cache, tried force downgrading then upgrading and reinstalling the toolchain package, none of it worked)
they only show up when switching the build mode to webgl, and they happen in every project (even tho i build a few webgl games already, and none had this happen)
Hello fellas!
I'm currently working on a project that might work with a good audio and microphone I've worked before with Wwise but it seems to don't support WebGL. Maybe someone know the best path to take on this sound engineering? Thanks! @here
what is the game & the audience?
Its a simulation on webgl so you should be able to talk with other folks on real time.
why is it in webgl?
so it's not a game? it's like a training?
like it's an industrial application?
or a branded game / ad?
Its like a weird mixing of habbo and roblox, but one of the conditions is to get entirely on webgl
There are lots of options in that space. Photon Voice. WebGL Voice & Text asset, etc.
but why does it have to be pure webgl? what is the audience?
it's just a really bad fit for webgl
who's going to use this for more than 30s but wouldn't bother to install?
We have lots of clients with XR simulations that need them for WebGL as well, its pretty standard in education.
does this have to work on phones?
Yes
Dude, it's not my business haha
I'm just the guy who does it
We had to create something for our SocialVR platform as well, to let browser users join the same community and participate 🙂 It's pretty common imo.
Thanks for the recommendations!
does it also have to support phones, in webgl, on mobile safari?
This is probably the quickest way to get started with it these days WebRTC https://docs.unity3d.com/Packages/com.unity.webrtc@2.4/manual/sample.html
Not for now. But it will.
do they have a budget?
i can tell you now, the webrtc package is not something you want to go down
Yeah, they have
Probably I will get into the already-created assets for this
is it going to be like a 2d pixel art experience, or 3d move around your anthromorph in 3d person?
yeah i hear you. i'm trying to be helpful there's a punchline to all of this
are they making their own art in 3d?
Its an immersive 3D work, that's why I need a good sound system
got it. and it's original assets or scanned assets or...
like when you say immersive do you mean photoreal 3d assets?
What are you using for networking in the existing version?
I'd definitely stay close to that if you can. So if it is photon, adding photon voice, etc.
We're struggling with mirror and playfab
Yeah, I saw some stuff pretty cool on photon, but its not the case
Gotta go guys, thanks for the recommendations!
Yeah with mirror, you'll end up needing to create something manual, imho.
i build a pixel streaming platform you can easily try, for free, if you so choose. you can achieve multiplayer by having multiple people share the same unity instance, so like a local multiplayer game. and wwise would just work. but i'm trying to understand what precisely it is that you're making
i'm not trying to be annoying
most people will bounce waiting for something to load
so that's why i was asking if it was an ordinary video game - generally people are willing to wait for those to load - but if it's something that gets an audience inbound from e.g. instagram, tiktok, cocktail parties the creators of this experience go to - webgl is impracticable
I have a couple of questions
- Why does profiler show me ~60 fps, when the game feels like ~10?
- Does NavMesh work differently on WebGL?
I'm rebuilding the navmesh frequently and it works fine on mobile, but not on WebGL. - Can the performance be improved?
Why does profiler show me ~60 fps, when the game feels like ~10?
what browser & platform are you using to play the game?
try setting this to true https://docs.unity3d.com/ScriptReference/PlayerSettings.WebGL-threadsSupport.html
@frosty idol you will have to correctly configure cross origin policies if you want multithreaded support in mobile safari
Unity 2022.3.9f1
Firefox 117
Win 10
CPU (4/8 @3.6Ghz)
GTX 1660
I've tried to set this bool to true
And got an error
Uncaught (in promise) Your browser does not support multithreading.
So, it seems that firefox doesn't support multithreading out of the box.
Will try to tweak some settings.
Tried to turn on everything thread related, but no dice.
Upd: tried google chrome, the error is still here.
Upd2: tried to set 'hasThreads' to true in the 'Web.loader.js', the game started, but the performance is the same.
Upd3: it worked in google chrome at least
Upd4: it stopped working, when I've tried to upload the build to itch.io
when you test threading support, what is the URL you visit?
if it's an ordinary, WAN accessible domain name, write wan-domain.com
After multiple tries to make 'MultiThreading' to work, I've abandoned this idea.
Also, the game runs smoothly in the Google Chome.
So, it might be that Firefox WebGL renderer is just slow.
How to use .env files in Unity WebGL build?
In Emscripten recommends to use ENV variable and presetup it with Module.preRun
Emscripten-generated JavaScript cannot access the computer’s environment variables directly, so a “virtualised” environment is provided
// *.jslib
mergeInto(LibraryManager.library, {
Message: function (str) {
console.log('Message', UTF8ToString(str), ENV.NEXT_PUBLIC_DOMAIN);
window.postMessage(UTF8ToString(str), ENV.NEXT_PUBLIC_DOMAIN);
},
});
- Emscripten cannot access to
process.env - I need to get
NEXT_PUBLIC_DOMAINvalue only - I can run build with command line using custom Build class:
using UnityEditor;
using UnityEngine;
public class Build
{
static void WebGLProductionBuild()
{
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
buildPlayerOptions.scenes = new[] { "Assets/Scenes/SampleScene.unity" };
buildPlayerOptions.locationPathName = "Build";
buildPlayerOptions.target = BuildTarget.WebGL;
buildPlayerOptions.options = BuildOptions.None;
BuildPipeline.BuildPlayer(buildPlayerOptions);
}
}
With following command:
. .env.development && Unity -quit -projectPath . -batchmode -executeMethod Build.WebGLProductionBuild
yes, multithreading only works when two headers are set
i wouldn't overthink it. simply copy the public domain value. next inlines the variables in your client code.
even if you achieved your goal of "using .env files" it wouldn't resolve your issue, because that's not how next works
if you want to access a value from the page, it seems you already know how to do that
I want to send value to the page from the Unity WebGL app, which is here a wasm code read by Emscripten.
In Unity documentation recommends to duplicate class method in *.jslib file so when it called the same method in jslib file will be called.
https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
So, here will be called window.postMessage, where in second argument need to pass the page address to strict application by which address it will be listened.
Always provide a specific
targetOrigin, not'*', if you know where the other window's document should be located. Failing to provide a specific target discloses the data you send to any interested malicious site. https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
What I want to archive, to make a template for Unity web apps, where I can specify that targetOrigin in one source of frue so inside unity app I send message, and inside nextjs app - listen it.
The path I chose is not easy one, but I don't want to store any secrets in the repository, so I decided to use .env files both in NextJS and Unity code.
what are you trying to make?
i am not sure what the issue is here, you don't need to interact with next.js's unusual public variable configuration inlining thing at all
ok
what is your goal?
why are there popups or same origins? what is the game / experience?
I already did that I want. Now, my goal is to improve it.
https://r1nge.itch.io/runandbomb
firefox for me runs well
so maybe something is misconfigured in firefox for you
Tried reinstalling firefox, gpu drivers.
Nothing helped.
So, I just switched to chrome.
Hello guys! I've been really stressed trying to deploy on webgl using some playfab services for multiplayer. Maybe can someone help me with this? 😦
what is your specific issue?
The multiplayer system works pretty fine on windows and android, but it does not on webgl
what is the context of these error messages? they are obviously meaningless by themselves
like describe what you are doing
and then why you looked in devtools in the first place
are you confident playfab is supported in webgl? what are "some" services?
oh yeah you were asking questions earlier
do you have an urgent deadline?
Yeah
did you author the windows and android version?
what exactly isn't working in the game?
Yes
Doesnt connect from client to server
i think the first step is identifying where these exceptions are coming from. you can make a development build and enable demangling in order to see a real stack
-sDEMANGLE_SUPPORT=1 is the additional emscripten compiler args although i think that's automatically enabled by checking Development nowadays
so these errors appear when?
when you launch the game? are you confident they are associated with "connecting?" what does that concretely mean, connecting via mirror?
are you trying to use mirror peer to peer with webgl?
maybe the first thing to do is to ask for more time and money
People are going to have a hard time helping you if you don't provide enough information about your setup. References to KCP suggests to me that you aren't using a browser compatible transport. Mirror has a WebSocket transport available if that is what you are using.
What version of webgl is ued by unity in the web platform?
2.0. 1.0 is available in older Unity versions.
anyone know a reason why the second I build and run my game in webgl, Painted details on terrains turn almost invisible???
check quality setting
Nope, on high fidelity for webgl
there are a lot of graphical issues in both screenshots. what a mi supposed to be looking for?
are you saying the left is incorrect and the right is correct?
Anyone heard of using webGL as a way to let people use multiple mobile devices as touch controllers for a game running on a PC as non-web-gl?
Would want the mobile device to just display joystick/buttons & transmit data to the game.
I've kinda implemented a non-webgl solution last year that used websockets to send touch info to a nodejs server running on the PC & then sent that data to unity via redis. But curious if a webgl solution might make more sense?
I setup 360 projection-mapped geodesic domes as an Art Installation and have a game that let's someone fly the dome around space with a joystick. I'm adding multiplayer to it where people can use their phones to interact
Greg has made something like that in the past
But it's unsupported.
you can read about unity's input system remoting features, which i believe have been used by various assets or an official unity package (maybe, i don't remember) to allow you to attach a browser and its supported inputs as a user to a running, remote unity instance. this is how appmana, my unity game streaming solution, connects browser inputs to a remote unity instance.
how buggy do you want this experience to be?
Less buggy is better but it's really just a fun side project for now
This looks really interesting!
What problems have you run into using the remote input like this?
Sorry for the delay, but yeah, the right gets the grass to spawn and render, and the left it’s not visible… if shadows are turned on however, the shadows still appear just the meshes have their alpha turned down to like 0.1. (It’s for my game dev coursework… we’re only allowed to use 3D primitives included in unity, no external stuff is allowed)
it works very well. it's just a pain in the ass to set up
pretty much flawlessly
you will have to understand how input system works. that is the main obstacle
you can of course reinvent input system yourself
that's all you'll end up doing if you do the blub thing of like
oh i need a class that represents each user
now i have to associate a remote connection with a user as a device
now i need some way of representing the touch...
input system has already done all that
does that make sense?
it's a huge amount of IT either way
InputSystem.QueueEvent allows you to pump input system events from anywhere, that is the single simplest way to remote input. you can also assign a user and AssociateDeviceWithUser. then you basically have a local multiplayer experience
hmm i'm not sure what the issues are
Gorcha, thanks so much for the info!
i think you're gonna wanna blub it
how much do you want to do input system
Not sure - you're making me think maybe I don't wanna use the input system haha. I'm comfortable just blubbing, I'm not gonna be getting too complicated with things I think
whats the best way to fake a cloth simulation in webgl?
You could use bones, joints and sphere colliders in most cases
you can try obi cloth and see if its performance is acceptable, as afaik burst accelerated compilation does not support webgl
I found that simulating in blender and then converting to shape keys and exporting to unity as fbx works pretty well
Had some problems with file size but I’m good now
Yeah that'll work too
It wouldn't be physics reactive but might not be needed anywya
Hi, I can't show an example right now, but webgl quality is good in any pc, but is very bad with low fps in mobile devices... is it because it's incompatible or shouldn't that happen?
I'm using URP 2D template
Hello, i have got an WebGL Asset, which i want to scale and rotate by pinch.
Pinch Rotating works fine, but if i finger pinch scale the object the WebGL crashes instantly (Android and iOS) with these error message. Does anybody has got a hint? 😦
You'll have to set up remote debugging to read the error message from the console
are you using webgl for mobile? Are touches officially supported for that workflow?
Yes. I have many other project in which it Workshop correctly 😦
can you scale the object normally? It might be the type that it's not happy with
hm. What do you mean for example?
like just hookup some other input to scale the transform. Just narrowing down that it's probably a type issue with touches
do you have a video?
there isn't enough context to answer the question here
do you have a video?
Hello, I wanted some insights on how I can incorporate a website with a Unity wegl build.
Lets say I have a website made with react. There are several buttons and I want to attach Unity games/scenes to each of the buttons.
I am pretty new to the webgl build and wanted to know possible ways this can be done.
Interesting username. So what we did in the past, is set two functions (one unity side on javascript side) for sending json requests between them. That let us create a small web -> unity API. But you could be less strict if you wanted
https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
If you Google that you will get a forum thread from Unity that says no as your very first result.
Here Young can Check 🙂
all this shows me is my camera feed after it loads. what is the objective? do you need markerless AR in a way that works for mobile safari?
it's an asset living in 3d?
Ist is an Avatar hat you can Place markerless. If you try to pinch scale ist crashes 😦
this is streamed and using HDRP. so you can test AR from the editor directly, and exactly what you experience is exactly what is deployed to everyone. would you prefer to use this approach?
there's no webgl. it just loads instantly, and all you have to do is push to git. you never have to build yourself.
this works on mobile safari, as you can see
Hello, i have very big issue about loading times. My game is only 30mb and i got 50mbit internet speed. Usally game speed beetwen 15-30s but sometimes is increase to 3-4 minute. I'll be happy if you can help me about that.
Game size is 30MB. When i'm check in profiller Set Texture is like 10-20MB, Render Texture is 200MB.
host your game on a CDN, like by uploading it to itch.io or by using cloudfront on aws
then time it
on mobile, everything loads slower
do you have a screenshot of your game?
Hello. I've created a WebGL project, but I have an issue with slow website loading. How can I speed it up?
- Enable compression in Unity settings and on the server
- Reduce game size
- Find a faster website host
hey guys 🙂 I need to be able to trigger javascript code from within c# and I have been trying to use the following code ```cs
public class IFrameToggler : MonoBehaviour
{
[DllImport("__Internal")]
private static extern void ToggleIframe();
public void ToggleFrame()
{
ToggleIframe();
}
}
with the following script in my (custom) webgl template (index.html) ```html
<script>
mergeInto(LibraryManager.library, {
ToggleIframe: function () {
var iframe = document.getElementById('iframe-element');
if (iframe) {
iframe.style.display = iframe.style.display === 'none' ? 'block' : 'none';
} else {
console.error('ToggleIframe: No element with id "iframe-element" found.');
}
}
});
</script>
and I get the following errors every time.. ```
Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js: undefined symbol: ToggleIframe (referenced by top-level compiled C/C++ code)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
error: undefined symbol: ToggleIframe (referenced by top-level compiled C/C++ code)
warning: Link with -s LLD_REPORT_UNDEFINED to get more information on undefined symbols
warning: To disable errors for undefined symbols use -s ERROR_ON_UNDEFINED_SYMBOLS=0
warning: _ToggleIframe may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: '"C:/Program Files/Unity/Hub/Editor/2022.2.5f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/node/node.exe" "C:\Program Files\Unity\Hub\Editor\2022.2.5f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\src\compiler.js" C:\Users\scott\AppData\Local\Temp\tmpg6rmczff.json' failed (returned 1)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
I have tried everything.. If you guys have any pointers or any idea what the issue can be, let me know! Thanks in advance for the support!!
@unique hawk Use JSLIB. Create JS function at HTMl side and create JSLIB on unity side (under plugin folder). After that create fucntion to call it from jslib. Unity using emscriptten to communicate with JS.
I uploaded game on itch.io now it is loading faster. i think problem about server side.
thanks I will look into that! 🙂
Does anyone know how to make online game in browser with webgl?
you can try something like this with chatgpt gpt4 to investigate: https://chat.openai.com/share/44da871f-5830-4e92-88a7-53bbedb3d6f4
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Hey! I was wondering if it's possible to share a link that would open the game in webgl redirecting directly somewhere. Like for example I'd share a link of the game url with an id "app.site.com/id" and reading the id from Unity and then do something in the game based on this id
URLs in the form "app.site.com/id" requires server setup, query parameters (app.site.com/?id=123) work without special setup
How would that work? Or is there an alternative of having an id in the url?
Oh okay I read wrong, so I could use app.site.com/?id=123, and then retreive this info via Application-absoluteURL?
yes
Working perfectly ty very much
From the following can anyone tell what could be afecting more performance in unity webgl?
- Shadow Caster 2D from URP (around 50 objects with the script)
- Vector Graphics for sprites (around 50 objects in a scene) : https://docs.unity3d.com/Packages/com.unity.vectorgraphics@2.0/manual/index.html
- Just URP lighting in general (around 10 lights per scene)
(or none)
The thing is, it's a very simple 2d game but the more objects I add to the scene, the more it lags on PC... it's bad
Profiler doesn't seem to show any problems performance wise. But it runs well on the editor
I don't use URP, so I can't weigh in unfortunately
can you share a screenshot of your profiler when connected to the browser player?
Well seems like it's the shadows...
right?
I have a low/medium end laptop (that's why fps are relatively low)
yes. shadows (1) are ordinarily submitted as jobs (2) webgl is single threaded (3) you probably want to use culling / limit the number of game objects your lights can illuminate, because this looks pretty excessive even for 4 lights
Interesting. Doesn't culling happen kind of automatically in unity 2d?
There is only one light that creates shadows actually. this scene has a total of 61 shadow casters...
Might Shadow Caster 2D just be a bad solution?
Are there any other solutions for this?
All shadows disabled
Ok the game actually runs at 60fps on the phone without the shadows lmao. previously it ran at like 15 fps
Are we sure this Shadow Caster 2D script is not actually poorly written by Unity? Is this really not a bug?
URP version 12.1.7
is it possible to save info to something like a password manager?
Anything that would trigger a "login" to save login info?
I was thinking that I could possibly hide a username + password input on the page, and just edit them manually with some js function every time the webgl inputs are changed.
but that feels super hacky.
i'm not sure. i think yo ushould configure your lights carefully and not make any assumptions
My webGL built Users in Safari the ear speaker and Not the handsfree speakers. So it is too quiet 😦
How can i handle this? 😦
Maybe just need to switch the audio device? https://docs.unity3d.com/Manual/class-AudioSettings.html
true, I tried a few changes to the lights, doesn't seem to improve performance...
Do you know of other solutions to this?
Or does anyone know any "alternatives" / fake 2d shadows instead of Shadow Caster 2D?
it's likely a bug that it performs so poorly, i agree with you. i would at least ticket your scene. i am not sure of alternatives
Sorry for the dumb question, but where would I "ticket" my scene?
report an issue from the editor. it will prompt you to attach your project
When you can't find info in the profiler you can spot check too. Try disabling all lights or all but one and do a build. If that runs well at least you know the culprit.
In 3D space, real-time lights are very intensive. But you can tell via profiler and seeing the batch and poly counts massively increasing in the stats view
is there any way to access the clipboard on webgl?
the systemCopyBuffer doesnt work
and it seems like copy pasting in general is weird
into a text mesh field? I don't think that's supported
Unity 2023.3 seems to be adding it
Web Platform: Added the ability to copy and paste to and from the Unity player.
https://unity.com/releases/editor/alpha
There are various copy and paste solutions for the web platform on Github
no just accessing the clipboard directly
a button that just pastes the text into the game
it works in engine but not in webgl
i dont think thats what im looking for
im pretty sure thats referring to ctrlc ctrlv
Yea I guess systemCopyBuffer support isn't a given in that change. If it can be accessed in JS, you can use browser <-> Unity scripting to implement it https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
ill look into it thanks
how to fix?
What editor version are you using? I don't think current versions support mobile browsers.
2023.2.2f
ive decided to make a custom onscreen keyboard because there are also other issues with the on screen keyboard
I have spoken with the PM in charge of webgl on mobile, they say mobile web support comes in Unity 6. It is not supported in 23.2.
Just an update on the Shadow Caster 2D performance issue:
I just gave up on it and made my own "fake" shadow caster, that's it...
looks good for my use case
it's not an actual shader, just creates a light 2d with the correct shape path
and it's possible to make it finite
even webgpu runs in 1 of 3 hardware accelerated in chrome/not yet opera - give a try check it out,
we mostly all can run webgl and optional webrtc in modern browsers and they can more see what is saw,
webrtc in udp instead tcp but no fast as good sample yet if anyone has it put it here please.
notice webgpu req updates and enabled flags adjust resoulution, before you also try this new xp:
also, if you have a new mobile device than my old smartphone that runs it give a icon here, thx.
https://boat-demo.cds.unity3d.com/ # it is rendered and calcualted in perfomant gpu not a video
So is there any way to get Cursor Lock working in WebGL for something like a third person camera. Where you right click, it locks, you orbit the camera around, then unlocks when you let go of the right mouse button. It always needs a second input from the keyboard or left click to actually lock which is not normal behavior.
For anyone trying to do cursor locking in webgl, the solution is to call into native js with a .jslib file in unity.
Jslib:
mergeInto(LibraryManager.library, {
LockCursor: function (lock) {
canvas = document.querySelector("#unity-canvas");
if(lock){
canvas.requestPointerLock();
} else {
document.exitPointerLock();
}
}
});
C#:
#if UNITY_WEBGL
[DllImport("__Internal")]
private static extern void LockCursor(bool @lock);
#endif
private bool _isCursorLocked = false;
[Conditional("UNITY_WEBGL")]
private void CallLockCursor(bool @lock) {
LockCursor(@lock);
_isCursorLocked = @lock;
}
right click, two fingers touch or esc or tab than on update check the key and call mouse pointer lock, just on build js file gets overwritten.
good afternoon, I got on this server since im looking for help with my first unity project. The colliders of my game are working correctly on the editor window but when i try to build they dont work, I tried debugging to make sure the colissions were detected and the collisions did log in. I made sure the player object and the walls were on the same layer and made sure an 2d physics that the collision matrix was in order.
You're going to need to provide much more specific info for people to want to engage with this. What's your build platform Edit: yeah my bad didn't notice i was in the webgl channel lol
nevermind i found that the error was on the prefabs that I was using as tiles
Nice!
it will never be possible to achieve the following:
- there is no keyboard on screen in mobile safari
- the user taps a
canvaselement anywhere in the page. - the keyboard appears.
there isn't enough context here to fix your issue
trying to upload a game for a gamejam but the music tracks sound crackly, the first one is in the editor and the second one is in the build
though the crackling only happens on 3 tracks that i have overlayed on each other to get an adaptive music system, does the volume changing cause this?
I usually change the sound more subtly. Adding a volume as a target, and then slowly fading to that volume over time via an update or coroutine. That way it's a lot smoother with less spikes and it rounds off the unexpected peak changes. Depending on those stats that volume could change all over the place
I'm getting this error when I upload the newest build to my website
RangeError: maximum call stack size exceeded
at invoke_ii (http:mywebsite.com/Build
web_build.framework.js.gz:3:371759)
at wasm://wasm/04d1fa46:wasm-function[5506]:0x18a4dc
any idea what's happening here or how to fix it?
~~Any suggestions on this build-error?
My online search has only resulted in suggesting "something" is unsupported, but I can't identify what. (Perhaps I'm missing something in the error message?)
Build completed with a result of 'Failed' in 1941 seconds (1941457 ms)
Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
emcc: error: '"C:/Program Files/Unity/Hub/Editor/2023.1.20f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/binaryen\bin\wasm-opt" --strip-dwarf --post-emscripten -O3 --low-memory-unused --zero-filled-memory --strip-debug --strip-producers Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.wasm -o Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.wasm --mvp-features' failed (returned 2147483651)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)~~
I think this was a local memory issue. I restarted Unity, built again - and it succeeded without changing anything.
is there a way to check if my built game is running on a mobile device? or even better, check if the device has touch support?
I'm developing the camera navigation and it should be different on touch devices
second question, is the UIElements better for webgl when compared to the uGUI?
I don't know if there's a better way, but possibly look into Application.platform, if there's no good #if compiler conditions to check for.
I found a solution, I'm using InputSystem.GetDevice<Touchscreen>() to check if it exists
So far I'm loving UIToolkit (if that's what you're referring to). Overall, I do highly recommend it, but that's just me.
However, I am having an issue with WebGL... not sure if it's something I'm doing wrong, or what. (my own question, incoming...)
Nice, glad you found something. (I'll have to look into that when I try and build for mobile, myself)
Regarding WebGL issue, with UIToolkit... [If this belongs there, let me know]
Setup
Splashscreen loads a MainMenu scene with a UIDocument
MainMenu UI has a button that queues a scene to load, the LoadScene is done in Update.
The new scene loads, with its own UIDocument that has a button, that queues returning to MainMenu scene, also loaded in Update.
Problem
The MainMenu UI does not load when returning to it.
This only occurs when playing a WebGL build.
It does not occur in WebGL Editor, or in a Windows build.
Error
The only error that seems to happen around the same time:
InvalidOperationException: Stack empty.
at System.Collections.Generic.Stack`1[T].ThrowForEmptyStack () [0x00000] in <00000000000000000000000000000000>:0
Observations
Two notable variances:
#1) Build a UIDocument in my script in Start(), with AddComponent<UIDocument>() - The error occurs during that call.
#2) Have existing UIDocument, accessed in Start() with GetComponent<UIDocument>() - the error occurs before .Awake(). GetComponent will return a UIDocument; however, rootVisualElement will be NULL.
#3) One UIDocument on a different DontDestroyOnLoad() object, using this.uiDocument = different.GetComponent<UIDocument>() - The error occurs during uiDocument.panelSettings = this.panelSettings.
#4) One UIDocument on a different DontDestroyOnLoad() object, like #3; however, this time not overwriting the settings/asset, instead .Add() to the existing root. - The error now occurs during menuUI.visualTreeAsset.CloneTree();
I added another Test Observation (3), that has similar behaviour.
I wonder if I should move this to (or mention this on?) the ui-toolkit channel?
I'm starting to feel it may be more specifically UIToolkit related... even though it only happens in a WebGL build.
[I don't know how to move a message on discord, though, if I should. (?)]
Edit
And added #4.
@vocal vapor Are you still working on this? Can you share the entire stack trace where you pulled InvalidOperationException: Stack empty. at System.Collections.Generic.Stack from, if so?
I very much am still working on this... for three days now x.x
I tried recreating it in a brand new scene, but wasn't able to. So... it's got to be something I'm doing, somewhere.
I've taken to copying the entire project, and am slowly ripping out every component to try and narrow down the culprit.
https://pastebin.com/GsmCSUcX - I didn't want to paste it here, it's a lot.
[Or alternatively, let me know how else I should paste large content]
What's really fun, now, is the latest version I'm testing...
I can go into the game, then back to the menu, 3? times, give or take. Before it does the breaking (as earlier described)
I've taken to copying the entire project, and am slowly ripping out every component to try and narrow down the culprit.
Good idea to try and isolate the issue from the rest of the project.
I can go into the game, then back to the menu, 3? times, give or take. Before it does the breaking (as earlier described)
My intuition is wonder if there is a memory leak somewhere...? Especially if the issue doesn't show up until something happens after a certain point.
I'm wondering if there's a memory leak, as well. Possibly a missing -= event, maybe. I'm not sure yet. This copy of the project should provide more answers; I just need more time to continue widdling it down. I'll update with what I find... either some silly thing I missed, or a simplified sample project to example the issue.
I just need more time to continue widdling it down
I'd say you should be building it up instead. Presumably you'd be able to easily add the elements in an empty project to know if the scene transition mechanism.
You should probably use the webgl profiler too; though, I haven't used the profiler on a webgl project (yet). I have used in the editor and on desktop applications.
It's a lot easier to tear down in this case, than build up.
I've not managed to get the profiler attached with WebGL. Memory Profiler attaches, but regular Profiler doesn't; haven't figured out why. Though I could use MP to check before/after each load... see if it might be a memory leak. Hm. I'll try that on the next test, after this pass on disabling things.
It's a lot easier to tear down in this case, than build up.
Hmm sus... Asking for curiosity: why?
To me, at least - It's a lot easier to prove the issue is still happening, after removing things - than it is to spend time adding things, not knowing if what you added will be the break.
Memory Profiler showed pretty consistent ~452MB, so if it's a leak, I don't think it's significant enough to be the issue of taking too much. Unless there's an accessor happening somewhere (which is my lean towards a missing event unregister)
Yup that's usually the best way. I usually recommend removing half of the potential culprits each time, as opposed to one at a time, when there are quite a few possibilities. Urp. Models. Enviro. Shaders etc. It can greatly speed up the narrowing down process.
It's probably important to mention memory works different on webgl as well. As garbage collection can't happen immediately, it happens on the next frame. So even a lot of json/linq string requests can build up a crazy amount of ram between frames
I think I finally got a clue, with a new error message around the same location:
InvalidOperationException: Failed to Free handle with Index=0 Version=0
This new error lead me here-
https://forum.unity.com/threads/1391191/
Which has a link to another bug report, which further has more links.
I think this might be the bug I've been fighting for the past 3 days.
Though one of my tests, did leave the root UXML, and only added/removed elements. So I'm not 100% certain it's the same thing; but, it's a big clue.
Hey guys, with a WebGL build is there a way to interface with the website code?
I've used a .jslib file but I want to import functions from javascript that is included with the website
outside of the Unity build.
just call the functions
The functions you want to call must be in the global level
🆘 🆘 🆘 Help 🆘 🆘 🆘
anyone have suggest unity webgl ar plugin Free and some one time purchases asset plz help me
I've had a great experience with MindAR. There is a Unity plugin that's free and they have their own more complex paid one.
In the future I wouldn't post my question in multiple channels, and this hardly seems like an emergency to me.
Personally I prefer WebAR to not go through Unity though. Much easier and lighter to work through typescript m
The functions you want to call must be
I finally found the "smoking gun" culprit that changes "make it or break it" in my situation:
SceneManager.LoadSceneAsync() - This will eventually break UIToolkit. Even if the old scenes are being unloaded.
SceneManager.LoadScene() - This, as of yet, does not.
When building my day-1 reproduction test, I accidently used LoadScene, which was a deviation from my actual project code. Resulting in a sort of 'false positive'.
Granted, the issue is not specifically related to SceneManager - just, that is a key component to reproduction.
If anyone wanted to see the issue for themselves, I made this during my testing (and looking for potential workarounds).
https://github.com/BadgerMeles/Unity-WebGL-UIToolkit-Exception
I'm looking forward to when you are able to resolve the issue. Thanks for the updates.
Oh, I don't think it's a "I resolve" issue.
I'm pretty sure this is a legit Unity bug, that's been reported (one of the links in that github I posted).
If not "I resolve" at least "I find workaround"
Yeah. My current workaround will be to just use LoadScene instead of LoadAsyncScene - which will require reworking some things, so I can quickly load a "nearly empty" scene so it loads as fast as possible. (Otherwise the music "freezes" when not Async). Then just turn things on once the new scene is loaded, and has its own music/sfx going.
e.g. do you get an "index out of range" if you wait 0.2 seconds after loading a scene to then access..?
I've never seen the Index Out of Range error.
But my tests do have an example that delays loading/setup the UIDocument after the scene loads - and it still throws the Exception. So, not a solution.
what is easiest way to Fetch Session Storage Key value from WebGL build
currently facing few errors, any help is appreciated
Show the code and the error
manage to solve the issue using some GPT
getFromSessionStorage: function(str){
var keyName = UTF8ToString(str);
var returnStr = sessionStorage.getItem(keyName);
var bufferSize = lengthBytesUTF8(returnStr) + 1;
var buffer = _malloc(bufferSize);
stringToUTF8(returnStr, buffer, bufferSize);
return buffer;
}
as i am very new to JS this was code that was added to JSLIB inside plugin folder
this is implementation is for getting data for SessionStorage
Hi, Can i use microphone in webgl?
you would have to set it up via a jslib. it is tricky but doable
Hi!
Can someone help figure out performance issues on iPhone? (WebGL project running in browser)
The issue seems to corelate with UI updates. Lately there have been some new features in our project and those added a couple new buttons to the main UI Document of the project. Since then the game glitches and crashes after click events, most commonly - those that call back to JS (the project has a web component too), but sometimes - even after clicking a button that just opens a UI window.
The problem occurs on iPhone XR (iOS 17, Chrome ver 120.0). Also checked on Google Pixel 3a (Android 12, Chrome v 120.0), but it ran smoothly there.
Hi, I'm having a problem with UIToolkit input field when building for webgl and using full screen
the mobile keyboard is not showing up to type the input value
it works as intended if I'm not on full screen
is it a known issue or something? I can't find anything on the web about it
The ui input field appears behind the canvas when on full screen
another question, in the unity default template they have this code to detect if it's a mobile browser and make the canvas fit to the whole page, but somehow my ipad is not being considered a mobile device here
any idea on how to solve it?
this is my user agent on the ipad safari Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15
hmm, it was a setting on ios, I wonder if it's the default value
Hey guys, I'm making a simple multiplayer project using WebGL and Mirror Networking. I want users to connect from a WebGL client in a browser to my server hosted on AWS. I've tested that my local WebGL and Unity builds can connect to the AWS instance IP but my WebGL build hosted on Unity cannot. Is there an obvious step I may have missed? Does Unity block multiplayer connections on their hosting?
Edit: In case someone else has a similar issue and comes across this. I found out the issue was that I was trying to use an insecure websocket connection from a secure HTTPS page. I can get around this either through setting Google Chrome's site settings to Allow insecure content, or through setting up a reverse proxy as described here: https://mirror-networking.gitbook.io/docs/manual/transports/websockets-transport/reverse-proxy
Well, if the canvas is in fullscreen it overlaps any other element on the html, that's how it works. Previously I think you could bypass that by setting the z-indez high in the other elements you wanted to overlap, but browser don't allow that anymore.
I think you could try to put the canvas and the other elements inside a div and then requestFullscreen on the div. And make the canvas width and height 100%, but not sure if that works
in the end I decided to create my own keyboard, in the end I just need to input some number
what you suggested don't work
what kind of worked was to make the document.body request full screen
but it didn't work very well on my ipad
that's why I created my own keyboard
unity's standalone webgl player can be problematic. Also WebGL does not allow sockets if you didn't know yet
Checking -- you can get a local webgl build running in your browser?
@hazy mural unity is really shy about documenting the limitation with keyboards on mobile devices.
the following is impossible to ever create on mobile safari:
- start with no native keyboard on screen in mobile safari
- the user taps a canvas element anywhere in the page.
- the native keyboard appears.
i understand that it is challenging to communicate to developers. they're going to get the takeaway that you cannot do text input on mobile safari with webgl. that is indeed true, you can't. it sounds like unity has decided it does not want to create a keyboard component, so that's 100% true.
how familiar are you with CORS?
what role does your server hosted on AWS play?
that's true, ipads are not considered mobile devices period. it's the default value.
it has been the case for at least 5 years
I actually found a way to detect it's an ipad
i mean of course it is possible
using the number of touches
to heuristically determine if something is an ipad, you can of course directly determine it has a touchscreen. but also, you should be using input system and pointers
then it doesn't really matter
do you have a screenshot of your project? i am concerned you wrote "Chrome ver 120.0" on an iphone xr, because it is mobile safari in disguise
I can make a screenshot, but I am honestly more interested in what you mean by mobile safari in disguise...
We have both safari and chrome installed on that iphone. chrome v120.0 and safari 17 (cause iOS 17)
okay, i googled it and found some info. thanks for the pointer. didn't know that was the case... will keep digging for now
webgl2 browsers can connect udp webrtc into node and join MultiPlayEr host/server in w/LAN+ unity 3d editor&build x64 hosted game, so browsers clints can join to host, see screenshot #💻┃unity-talk message
I think the new chrome update created a bug with webgl. TmproUGUI elements are flicker/disappearing, on other chromium based browsers it works fine.
Unable to parse Build/Build1.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.```
guys when im building my webgl I get this error on opening it
what can be the problem
It's telling you to disable gzip in the build settings.
solution: https://forum.unity.com/threads/unable-to-parse-build-html5-framework-js-gz-need-help.1083602/
yes I disabled
thankyou
Greetings,
I'm experiencing a mixed content issue in my Unity WebGL project when hosted on a web server with HTTPS. I'm using the "Netcode for GameObjects" package to handle networking. While the project functions seamlessly on a local web server, attempting to deploy it to an HTTPS-enabled server triggers an error:
An insecure WebSocket connection may not be initiated from a page loaded over https
I'm aware that this indicates the need for a secure connection, but I've been unable to find specific instructions on how to achieve this within the "Netcode for GameObjects" package.
Has anyone else encountered this challenge? If so, how did you manage to overcome it?
And let me know it it belongs on the #archived-networking channel.
you can try connecting to the http: version
or you can try your hand at certificate signing
I followed this guide for this but the issue still remains:
https://docs-multiplayer.unity3d.com/transport/current/secure-connection/
You can configure the Unity Transport package to encrypt the connection between the server and clients while ensuring the authenticity of both.
does that give you an ssl self signed cert error?
Thank you for your response. This is the error message now. The good thing is, it's trying to connect over wss. I guess there is something wrong with my certificate. I'll try with a new one to see if that's the problem.
private string mSaveDataPath = "saveData.json";
string fullPath;
private void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
mPersistentDataPath = Application.persistentDataPath;
fullPath = Path.Combine(mPersistentDataPath, mSaveDataPath);
if (File.Exists(fullPath))
{
LoadGame();
}
else
{
Debug.Log("No save data found in " + fullPath);
}
}
public void SaveGame()
{
Debug.Log("We are saving the game in path " + fullPath);
// we write the file will not include in discord
string json = JsonUtility.ToJson(saveData);
//File.WriteAllText(fullPath, json);
StartCoroutine(SaveGameUsingWWW(json));
}
private IEnumerator SaveGameUsingWWW(string json)
{
// Use UnityWebRequest to save the data
using (UnityWebRequest www = UnityWebRequest.Put(fullPath, json))
{
yield return www.SendWebRequest();
if (www.result != UnityWebRequest.Result.Success)
{
Debug.LogError("Failed to save game data: " + www.error);
}
else
{
Debug.Log("Game saved successfully.");
}
}
}```
I dont understand why my path is not found and returning Failed to save game data: HTTP/1.1 404 Not Found when the idbfs/Game is in my storage in F12 in firefox
Can someone help please?
Does anyone know why my webgl build is not working. I tried turning off the compression format and then building. I'm unsure what the errors mean.
Show the full error messages
discord cuts off the image but if you click on it
the full image would show
Those aren't the full errors. When you click on them the full error shows below
go through the suggestions there
Seems like unicode characters in jslib files cause it, if you have those it's an easy fix, if they're in assets then not as simple
alr
the unicode character might be what is causing my errors
my onedrive desktop folder's name is in another language
so im trying to change that
im not sure how i will manipulate the jslib files
or where to find it
so ill work on fixing the onedrive folder first
and then searching up how to change the jslib file if the onedrive solution does not work
It works!
thank you
the link pointed me in the right direction for solving the errors
what problem/solution json serialisation- utf8 not utf16 in uniycode, not custom- speical characte at begin BOM, and new lines are diffrent, from windows, mac, newMac, Unicode, Unity /n ( if Json library: JsonUtility.FromJson<MyClass>(json); ecma /n is linefeed, is right than shoud read and configure with parameters, Utf LE/BI (indians) and feature Convert To Utf-8 LI BOM NewLine Default , optional convert on Read (fix /n/r to /l .. remove BOM) Ansi Character Set a Lot more) filter paraghraph git on target unicode conversion: json utf8 noBom /n linefeed https://en.wikipedia.org/wiki/Newline
A newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or a sequence of characters, is used to signify the end of a line of text and the start of a new one.
do AudioClips work with Addressables + CCD in WebGL? I cant manage to load them without errors
Addressables does support WebGL. Local addressable assets are stored in the Application.streamingAssetsPath.
It sounds like you are running into InvalidKeyExceptions, did you build Addressables (in the Addressable Groups window toolbar > Build > New Build) before building the player?
I have it already built, but the errors I get say failed getting load state of fsb for "audio clip"
I guess it could be something related to this issue or similar?
How to reproduce: 1. Open the attached project ("case_1176470-AudioBugReport.zip") 2. Open the repro scene ("start") 3. Build AssetB...
There's no Solution?(?
looks like nom
Ok just Turned off antivirus .
Is anyone planning to make games for webgpu? I mean specifically aiming for mobile&web market, and betting on the performance boost?
#🌐┃web might need to be renamed to infer webgpu as well. I'm excited but feel it's going to be a few years before anything comes along to convince me to develop seriously for webgpu
Think unity's still waiting on specs from google on some of that stuff
WebGPU’s specification has recently reached version 1.0, and active development is still ongoing. WebGPU is enabled by default today in Google Chrome on ChromeOS, Mac and Windows, and in Chrome Canary on Android.
https://forum.unity.com/threads/early-access-to-the-new-webgpu-backend-in-unity-2023-3.1516621/
It's happening right now. WebGPU isn't quite there yet for Firefox and Safari. Mobile seems to be a bit more fragmented, but having solid desktop support would be a good start.
https://caniuse.com/webgpu
Anyone have a good resource for hosting a webgl game like diep.io with ads? I don't need it to be multiplayer
Hello, I used Game Server Hosting (Multiplay), but when I want to build for webgl, I encounter these errors. While I build for other platforms, I do not encounter these errors.
Does anyone know why the WebGL Wasm file is not caching in the browser, it keeps on redownloading again and again. My wasm file is 55 Meg and it's crazy for people to have to redownload each time.
Caching is (mostly) determined by the headers sent by the server
Could host on Netlify and use Cloudflare to cut down on bandwidth costs. Ad providers can be regular HTML ad providers controlled with https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html. Adinplay is traditionally known to be relatively easy to get in and a bit more forgiving than starting straight with Google Ads (messing up and getting banned by Google is very not ideal).
Make sure you don't have caching disabled in your browser debugging window! 😄
Awesome. Thanks for the info.
GUys why the hell the old cached webGl game is loading instead updated file 😭😭😭
So i need to generade New site for that!!!???
Is there any way to Fix that
is there any workaround to WarpCursorPosition()? This unresolved Unity thread from last year points out that it doesn't seem to work in webGL ("From the docs : 'On desktop platforms (Windows, Mac, Linux, and UWP), you can move the mouse cursor via code.' Implying that it is not possible in WebGL via Code)
https://forum.unity.com/threads/forcing-mouse-position-in-webgl.1239901/
player movement in my game is tied directly to the mouse position, and WarpCursorPosition() was how I was fixing a glitch wherein the player would pause, move their mouse to the pause button, and then the player would "teleport" to the new position on screen. Unless I can fix that in webGL I'm worried I may have to scrap the entire prospect of uploading it through webGL, which would suck cause I really want recruiters to actually play this (and from what I've heard they rarely if ever bother to download anything)
Changing file names is the most straightforward and reliable way to bust caches (of browsers and CDNs). Unity renames files for you if you enable "Name Files As Hashes" option in WebGL player settings.
Apart from changing the input method to a virtual cursor based on mouse deltas rather than using the actual mouse position, you could force the user to move their mouse near their previous position before the game unpauses. Max cursor follow speed and ramping speed up from 0 on unpausing could also help.
Thanks ill try
mouse deltas is currently the main method I'm considering. might also do a slightly hackier method and store a vector to calculate the distance between the player position and the cursor position on Resume, then just calculate player pos as cursor pos + that vector. Thank you
now it stuck at 90% when loading ☠️
Im just gonna use different less broken website.
is anyone else able to access itch.io at the moment? Every time I try to load I get "there was an error with your request"
and if itch is in fact down (rather than an issue on my end) does anyone have recommendations for other sites where I can upload and test a webgl build?
Hi. I am having a Unity WebGL project and my prototype works on localhost. But after I released it to my server I cant connect via websocket. I can use a java client and connect to my websocket backend but I cant connect via WebGL. Is that a certificate issue maybe? Any advice on this? I have no iptables rules, dont use CORS and nginx rerouting should work fine as the ssl certificate seems to be working with my java client. Any tips are welcome. I asked in #development beginner chat but was told to ask here.
Homepage and a page for a random game loaded here. Did you try a different browser? On a VPN perhaps?
It's up now, must've been a temporary outage
I am using Mirror's SimpleWebTransport which is supposed to work with WebGL (https://mirror-networking.gitbook.io/docs/manual/transports/websockets-transport)
Yes, it works fine locally using my Unity Editor as the Host and my browser as the client
I am not very familiar with CORS. There is a Windows build of the project on the AWS server which acts as the host (Windows build because the Editor fails when I tried to make a server build).
Mirror Networking uses port 7777 by default and I opened this port on AWS EC2 security rules and on Windows inside the AWS instance (My host). Maybe the issue is that the Unity WebGL game hosting (My client) would need to open port 7777 outbound but I have no way to control that?
Edit: the client does not need to open an outbound port, the issue was that I was trying to use an insecure websocket connection from a secure HTTPS page. I can get around this either through setting Google Chrome's site settings to Allow insecure content, or through setting up a reverse proxy as described here: https://mirror-networking.gitbook.io/docs/manual/transports/websockets-transport/reverse-proxy
Hi all, I'm attempting to run an WebGL build of my project, but on 'Build and Run' the web browser launches and locks up. This means I can't open the javascript console to start debugging the issue, which is the Unity docs recommendation of how to proceed.
My file size is ~20mb, which seems reasonable? I can only assume performance is poor in other areas of my game.
Does anyone have another method of getting logs? Perhaps I should load this only a local IIS server and turn on all the logging options? Any help would be much appreciated.
Edit: I've tried Edge and Chrome, but both have the same issue. My game is published to Itch here, [REMOVED LINK]
Is that the version that locks up for you?
I'm using 2022.2.20
I mean if you open the itch.io link yourself does it lock up, or does it only happen when you build & run from the editor?
Ah, it happens in both cases, and I've sent the link to others who have experienced the same problem
Well that's good news!
I'm guessing the shader errors are more severe in other computers
Thanks for the error messages, that gives me a good place to start!
what git / page you have or the source to find the bug (webplayer could end if error)
Hello everyone!!!
Does UNITY have any project samples or start guide on how to build a game/app using WEBGL?
I'm having some issues making a webgl app compatible also for mobile devices, specifically iPhones, do you have any suggestions or guide to share about that topic?
I asked this in one of the coding channles but it fits hear aswell
in one my my projects I am using a the google sheets api. This uses google authentication api which uses Newtonsoft.Json. My project throws the provided error when build with webgl when ever a google sheets api call is made. Through research I have determined that this error is caused by AOT. following this guide: https://github.com/applejag/Newtonsoft.Json-for-Unity/wiki/Fix-AOT-using-link.xml I created a link.xml file and included it in my assets folder. here is the contents of my link file ```xml
<linker>
<assembly fullname="AssemblyCSharp">
<type fullname="usesJson.handleLogin" preserve="all"/>
<type fullname="usesJson.USER" preserve="all"/>
<type fullname="Google.Apis.Auth.OAuth2.JsonCredentialParameters" preserve="all">
<method signature="System.Void .ctor()"/>
</type>
<type fullname="Google.Apis.Auth.OAuth2" preserve="all"/>
<type fullname="ewtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject" preserve="all">
<method signature="System.Void .ctor()"/>
</type>
<type fullname="ewtonsoft.Json.Serialization.JsonSerializerInternalReader" preserve="all"/>
</assembly>
</linker>
Newtonsoft.Json (Json.NET) 10.0.3, 11.0.2, 12.0.3, & 13.0.1 for Unity IL2CPP builds, available via Unity Package Manager - applejag/Newtonsoft.Json-for-Unity
Hi!
I was looking into a memory issue with a company project (WebGL) that was only occurring on iPhones and I think I might have stumbled into a memory leak on the WebKit side of things. Since I can't really visit random webGL projects from a company MacBook/iPhone, I would like to request some cooperation on double-checking that the issue is indeed webkit-related and maybe some help submitting an issue to the webkit bugzilla if it is indeed an issue on their part.
Now, a bit about why I think it is a WebKit issue as opposed to a memory leak in our app:
- Taking multiple memory snapshots (after load, 5, 10, 15, 20 minutes later) using unity memory profiler from an autoconnected development build didn't indicate any memory leaks
- The gradual memory usage increase (particularly - the part that Safari devtools labels as "Page") is observable both in our company Unity WebGL project, and 2 other company PlayCanvas projects
- Noted memory usage increase doesn't seem to be related to the safari profiler itself, since the increase is not present on regular web-pages (html, css)
I will start a thread for this and attach 2 10-minute recordings from Safari devtools timelines to illustrate the issue. Any help checking / comfirming the issue would be greatly appreciated.
hello, i have a simple very empty project with a single scene
i click on that button and it works as expected
but when i make a build it to webgl, the button no longer works
it does not even blink when i click on it, as if my mouse and keyboard inputs are not reaching the webgl
any idea what the issue might be, because it's working as expected in the editor
I'd start by checking the browser console for error messages (f12)
And keeping in mind you need to click on the canvas first to make sure it's active.
no error in console
so
I tried two things
1.
i added a TMP text in a corner and gave it input.mousePosition value
In WebGL build, the value stays fixed even if i move the mouse around, or click inside the canvas
2.
instead of using 2022.3.4f1, i switched to 2021.3.4f1, make the same setup, built, and this time the clicking worked
from the input, the mouse cursor seem stuck at bottom center of the canvas, and wont move no matter where i click
in 2022.3.4f1
I'm getting black screen after the initial Unity load if running a webgl app on mobile, is there any specific reason for that?
The are the 2 main warnings I get
I making game in webgl and I update my game to my server but i have one issue with browser cookie, each time I made an update to server I have to clear cookies to see my new update how can i solve this issue, I want it to update immediately without need to clear cookies. please help!
Browsers and CDNs like to cache everything, which is generally something you want. IMO the simplest way to update those caches is to rename your files, which Unity does automatically for your build output if you enable "Name Files As Hashes" in WebGL player settings.
@sweet oriole I just change version code in index.html and it's works for me but in some pc i required to hard refresh in-order to get latest updates
How exactly are you doing that?
Hi, I was facing difficulty when trying to implement Unity Relay on WebGl build it keeps giving me this message, please any guidance would be greatly appreciated
Listening for connections would be for hosting, no? I imagine you would connect to the relay rather than wait for connections, but I don't know the details of Unity's networking stuff.
well what you are saying sounds about right but I was following unity's official documentation for cross-play
where you can work out the cross platform functionality using this, as it says "accept connections from both UDP and WebSocket"
Is this specifically for relay or Unity Netcode in general? This sort of stuff is common if you have dedicated servers and need to be able to support multiple protocols. I don't think Relay would require this.
well to be specific, I am using Mirror, with Unity relay to perform Cross platform on PC and Webgl builds but since I am having difficulty understanding the issue and couldn't find much on google or any of forum I came here, I am am using a git repo which was a mix of both Mirror and Relay but it is not working for the Webgl build which is my biggest concern since Cross platfrom is a must for me.
Pretty sure Mirror is already cross platform, hence the multiplexing transport component
this was also written before this
https://mirror-networking.gitbook.io/docs/manual/transports/multiplex-transport
A common use case for the Multiplex Transport is a server listening for both WebGL and mobile / desktop clients. Your WebGL clients can connect to the server using a Websocket Transport and your mobile or desktop clients can connect to the same server via TCP or UDP transports. You can configure any number of transports in the Multiplex Transport.
that I have tried but I am using relay in order to connect different players around the world without the need for a dedicated server which the unity relay has
I have done this but as I said that I need to be able to connect any area around the world and perform cross platform functionality on it. I used the Mirror's but when used with different PC and Webgl opened it wasn't connecting to the host
There are some potential issues with something like Mirror in a peer to peer over relay type of configuration, namely with the host dropping out
Unless Mirror supports host migration now
I wasn't exactly facing the issue of host dropping more like client on the webgl build not being able to connect with the host on another pc build.
Yea I was just mentioning it, since I'm not sure if you have thought what happens when the hosting client drops out. Hosts need to port forward if there isn't some other mechanism to do it for them or bypass it (like a relay).
do you mean when the host client drops out and causes the session to end ?
Yes
no that bridge i'll cross later currently my biggest problem is Webgl not connecting with the host client
can you give me alternative to do this, which is doing cross platform, with Webgl (specially) with multiplayer functionality and be able to connect anywhere around the world.
For a managed peer to peer over relay setup I would historically go for Photon PUN, but that has not been replaced with Photon Fusion. I imagine it also works well for this, but I haven't checked it out and I'm pretty sure it's a bit more complex (with better results tbf).
Nowadays my alternative is to just not build multiplayer games without dedicated servers, since there are very few types of games where that's actually the ideal solution 😄
but doesn't Unity Relay helps out with the dedicated server part problem ?
Relays help to avoid the setup of forwarding ports for receiving connections, but it doesn't automatically make sure all state/data is kept on all clients so anyone can take over in case the "host" drops out.
I believe Photon Quantum demonstrates a more "hostless" peer to peer setup, but that's another can of worms in practice when you look at what Photon Quantum is doing.
I guess Photon Fusion it is. Thank you for the guidance.
I'd second using photon, it's what we use
I'm trying to make a WebGL playable on mobile devices, previously I used WebGL 2.0 and it went ok on Androind but on Iphones the page crashed for some reasons.
Now I'm trying with using WebGL 1.0, it opens on both devices and it runs cause I can see the audio be on both phone I have blackscreen.
Do somebody know what could be the issue?
(I've used Unity 2022.3.11)
webrtc datachannel sdp peer realiable:disable than fast udp webgl , ice servers can also be configured for stun&turn connections
try to update or change the browser, some like firefox other chrome latest for webgl 2, and of course update device for gpu acceleration, in pc you can check it with about:gpu (however unset - intel bug can crashes vulcan but webgpu is fine)
thanks for the tips
Also does somebody knows if and how its possible to call methods of a unity webgl app from the browser console?
Usually you'll write an intermediary between the two, so a common function you request through. https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html but yeah (check out: Calling Unity scripts functions from JavaScript)
so, via console, you could use Instance.SendMessage
with Instance you mean something called "unityInstance" or similar?
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {...}).then((unityInstance) => {
myGameInstance = unityInstance;
…```
It's the context in javascript when you create it
ok but this part should called in the site back/front end and not in the console right?
(sorry for newbie question but I'm not the guy who made the page so I'm trying to understand what is my part and what is not)
For my WebGL game I have an IPreprocessBuildWithReport class that generates some data about the build. It then saves this data as json to a build-info.json file under Assets/Resources. When I run the game in the editor, I load the file and display some info on the start screen (build time stamp, git hash, etc.).
I'm loading the json like this (during runtime):
var json = Resources.Load<TextAsset>("build-info").text;
And saving it like this (this runs when making the build):
File.WriteAllText("absolute/path/to/Assets/Resources/build-info.json", json);
My problem is that this does not appear to work at all in a build (itch or local). It works fine in the editor. Any idea what I am doing wrong? I found this documentation about webgl resources but I don't think it is relevant: https://docs.unity3d.com/Manual/webgl-embeddedresources.html
EDIT: I'm going to run with a scriptable object version (just a regular .asset that I update before a build) because that seems to work.
I don't think you're allowed to just access any file willy nilly when contained in the browser
File.WriteAllText("absolute/path/to/build-info.json", json); might need to be changed to point to someplace you know you have access to, like Lgk said with playerprefs maybe
Are you sure the UIElements label is failing in the constructor? Or is it failing somewhere else?
This runs at build time, not at runtime in the browser
oh derp that's right. Well the path you're writing to may be restricted. Where does it path to?
Assets/Resources
You are not allowed to write into the resources folder. Use PlayerPrefs or Application. persistentDataPath
That isn't true. You can write whatever you want wherever you want in the editor. Regardless, I was able to work around this issue (as explained in my original comment)
Interesting, I ran some tests and you're right. You may need to verify that the path is valid though
Hi guys, whats the best way to capture audio and vidoe in a WebGL build? I want to be able to output an mp4 file with audio and video, so far I've used a couple assets from the asset store that only record video well but not good for producing an mp4 with audio as well.
How can i setup google signIn in unity webgl build, there are documentataion about android and ios with unity but not for web+unity
Please let me know 🙏 I haven't found any guide about this
You can do a regular web signin page that then loads the WebGL page after sign in is complete
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {...}).then((unityInstance) => {
myGameInstance = unityInstance;
…```
Can somebody help me implement this in the index.html?
nvm I've probably solved, but wonder if there is a way to somehow automatically include it in the build to avoid having to edit the index.html everytime after I do a build
Sorry busy day, that's the javascript side. When the Unity template creates the Unity instance it should have a reference to it. That shows you how to call some methods into Unity from the Javascript side, which could be done via console. I don't have much interest in web development however, so I can't help much beyond that I'm afraid
But yes, you can and should create your own WebGL templates and use those
That way all your classes don't have Unity in the naming, and a bunch of Unity logos on your loaders and throughout.
Yeah I already use the "minimal" one
It's tricky and be cautious, a lot of those will use ffmpeg which won't work in an actual browser. Test often
I'll try to read documentation about custom templates
They are very helpful
You can basically copy their existing templates and modify them. But the infos in the docs and pretty decent on the subject
btw I'm happy that I made it work by myself (maybe is easy af but I have poor knowledge outside the Unity environment)
Awesome!
Yes none of them work very well. An alternative is to record the canvas object that the game instance renders to but then again there is the issue of audio. Is there a better way that I might be missing?
what do you use this for 🤔? atm im using unitywebrequest to call the web server and parse the data to use in my slots game but i was wondering if the way you did it would be an alternative for me
I'm using a webview to integrate a webgl game inside a mobile app (yes sounds weird but its the quickest way to port a game from the webgl pc version and Iin this way can keep developing only 1 build for all platforms) and looks like the browser console its the only way I have to comminate to unity there
what +additive size gets the webgl project if you use the webview, and what specific url/github/asset can you link it?
(advantage could be that also the native control keys / touch and android / iphone / keyboard could show of a filed focus?)
sorry could u explain better?
what asset / code you used for webgl webview at your example
oh thats unknown to me, another figure is doing that
here you said you use webview in webgl game
not on pc version tho, only on mobile since I use an mobile app and then the webgl inside
and in that case another guys is doing the app while I'm prepping the webgl to deliver to him
I'm having issue when trying to load a webgl app on mobiles, the app load (I can hear the audio) but I get a blackscreen on video
I've excluded all the "harmless errors" and I came down to this one:
GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment has zero size.
can somebody help?
Also I've noticed that on another site where the WebGL app is embedded it has no blackscreen error, so can I assume that its an issue on how the app got implemented in the website?
Hi, I'm trying to impletment signin with google into my webgl build, this is a documentation for web but its not for Unity https://developers.google.com/identity/sign-in/web/sign-in, how can i do this with unity using c#.
I was having difficulty implementing the stateAuthority funtionality in Photon Fusion 1, for a VR network object while I was doing that I realized why isn't a lot of the things in fusion not automated and rather have to be done manually? or is there any easier plug and play method?
Not sure #🌐┃web is the best place to ask that. #archived-networking seems much more appropriate.
Check out this doc:
https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
You likely need to call some javascript function from Unity. Unity creates some HTML files when exporting a webgl build so these functions would probably live there.
I have a 3D project that I want to export to WebGL. In the current build it works on computers and android phones. The only iphone it works on are 15/15 max. Can anybody help me problem solve? The goal is to get a build that works across computer and mobile. I'll make it worth your while. Let me know, Thanks!
I've been searching for a few days now trying to fix this issue.
I am unable to export to HTML in Unity. I get like 20 of these errors, even with a blank project.
System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423
at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 334
at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78
Any ideas? Im using Unity 2020.3.26f1
Using the newest Unity Editor solved this issue 🙂
I'd definitely start by posting the problem you are seeing on other devices, unity version, errors etc. Mobile webgl isn't supported well by unity.
Thank you for the reply! That’s what I’m hearing but we’re in too deep at this point. I’ve tested various devices. Seems to be fine on computer and android. On iPhone 14 and lower the load bar appears but when it finishes you are met with a white screen. It works on iPhone 15 and 15 max though. Version of unity is 23.2 I believe.
If anybody thinks they can problem solve it let me know I’ll make it worth your while
We do not accept job or collab posts on discord.
Please use the forums:
• Commercial Job Seeking
• Commercial Job Offering
• Non Commercial Collaboration
I'd start by looking at the device / console logs. But I'd suggest posting the exact unity version, the errors in the console itself, etc. It's possible it's either running out of memory, or something simple like disabling auto graphics. But the log will take you there. Without the log or profiling it's just random guessing.
On the second topic @eager grove you need to go to the forums for hiring etc. Links to above.
I'd try and make sure you have the latest version of unity. I believe 2023.x is when they began adding mobile support. I'd try disabling auto graphics and forcing it to a lower opengl just as a test step. It sounds to me like a mobile css issue though... I'd suggest trying to run Chrome or Firefox in mobile layout and see if that causes the same problem. If so, at least now you can use the inspector and see what's happening with the html - checking the canvas exists etc.
In those cases it's also worthwhile to do a micro test build (empty unity project) just to make sure it's not a issue with the builds - and without needing to wait for long build periods.
If you can narrow it down to a CSS issue, then you can create or edit the custom templates 🙂
I'd also get someone with android to test it as well. I remember seeing someone on here having a lot of memory issues with webgl on Apple devices, and I suspect that might be what you are running into. Assuming it isn't just a graphics incompatibility issue.
Here’s the console log from an Iphone8 on Safari. Unity version 2023.1
Yeah I assume this is the problem. Tested on 3+ android devices and they’ve all been fine
Thank you for the info. I posted up there early today as well
Ah those shader errors could very well be the culprit. It might actually be the autographics setting
Without the shader working it won't be able to draw things. It looks like it's using HDRP which I believe just won't work on webgl for mobile. But I'd force it to use OpenGL 2.0 (right now it's failing with 3.0). But I'm doubtful about HDRP on mobile over webgl 😦
This is very useful info thank you!! I will dive deeper
I kinda solved, since even a blank scene would get me a black screen I then tried a fresh new project and that same blank scene worked so the issue was within my project.
I basically exported all my scenes in a new project and the issue was solved, even using the same Unity version.
Maybe I had some bad unused asset that somehow still generated issues.
Now both android and iOs works with WebGL 2.0, the only thing I have to change exclusively for iphones is the color space, somehow i still get blackscreen when iphones open a Linear colorspace app, so for that instance I switch to gamma which is a bit uglier but a fair compromise
In that case I wonder if therese a way to automate a build outputting 3 versions:
-Linear colorspace and DXT texture compression (PC)
-Linear colorspace and ATSC texture compression (Android + Tablets)
-Gamma colorspace and ATSC texture compression (iOs)
will platform dependant compilation still correctly identify mac vs windows if both builds are running in webgl?
you're building you game for WebGL, not for Windows or macOS
so I would expect the answer to be no
hm damn
wait, HDRP works on WebGL at all? that's news to me..
i thought you were missing compute shaders there
I'm not sure to be honest, i didn't think so either, but it looks like they are using it on mobile with most platforms successfully.
I'm trying to adjust my mouse sensitivity and I'm noticing the ranges are wildly different depending on whether it's run from mac vs windows
that might just be editor dependant and I'm curently building it to run in webgl to check but I was hoping I might be able to define separate ranges for each platform
Definitely check how the build performs.
I figure they may have also imported it by accident but aren't using it.
I know that scroll wheel input is often messed up on macOS when people ignore the magnitude of the scrolling
the trackpad on a macbook sends lots of tiny scroll events
but that's unrelated to mouse input
Hi Friends, In webgl build i can not paste texts I copied from another tab or outside from my webapp, how can i paste text into inputfields?
I need to call a JS function inside the index.html but I read that application.externalcall is deprecated
what is the current alternative?
I made the jslib now I only this part of syntax
That's where you call the function you want
so I have to do this : Android.functionName(paramter) can I just putt it where the ??? are?
Yes, that's where you put the JS code that you want to run
ok thanks
oh, one thing
I have a block of code that want to include in the index.html (its purpose is to create a unityInstance)
Is there a way to somehow automatically include it in every build? Cause for now I have to manually write it inside the index everytime I do a new buildl
Put all that in the jslib
Oh right, that's not the function you're calling from the jslib. Forget that, it won't work then
so I'll have to manually put it inside each build...
Yeah I've read that plan B would be to make a template for seems a bit too complicated...
How is that complicated?
You copy the default template and add your script there, which is exactly what you've been doing so far after every build
ok then I'll try
BRUH that was dead simple
Idk why I got scared of that 
Now I'm using Minimal, next step is to take standard as bade and cut everything except the loading bar
I'm planning to develop a web game but a critical part of this project is the accessibility with the WCAG 2.2 guidelines. Anyone had test that and know if Unity is a good game engine for this purpose? Because I found that there are alredy some Unity addons for that purpouse but I don't know how good they work. I mean if I export it to web using HTML5 all the buttons and object will be accesible with keyboard, screenreaders can obtain the text from the buttons and menus, the screenreader works properly and all this. At the moment I'm just comparing different game engines and I think Unity is my best option. Thanks beforehand
Issue resolved. Solution: I needed to use the FQDN to connect (example.com) rather than the IP (123.45.67).
Hey guys, I'm making a simple multiplayer project using WebGL and Mirror Networking. I want users to connect from a WebGL client in a browser to my Windows server hosted on AWS. I was able to connect but I needed to allow insecure connections in chrome since there wasn't an SSL cert so I registered a domain, set up a reverse proxy using IIS on the server, and an SSL cert on the server following the mirror guide: https://mirror-networking.gitbook.io/docs/manual/transports/websockets-transport/reverse-proxy/windows/iis. On AWS I set the domain to redirect to the IP of the EC2 server. When I enter the domain in the browser it will load the WebGL game client. When I use the EC2 instance IP to connect to the server (hosted using a Windows build) it doesn't connect. Usually an incorrect IP will say "connecting..." for a while but this will instantly stop trying. I have also tried with the ports, with the domain name etc and those say "connecting..." for a while and then nothing happens. Does anyone know what may be wrong or which IP I am supposed to use to connect?
The Client transport is set to port 7777 and the server to 27777.
This is my web.config file:
you're braver than I to run that inside IIS
Hi I'm trying to upload my Ready Player Me with Netcode support (to use it as multiplayer game) in Unity. I recently publish it and once I paste the avatar url, I'm unable to click on the button it just doesn't load anything. This is the link of game: https://play.unity.com/mg/other/publicar-16 It works fine in my own computer but not when I share the link with other people it doesn't work for them. If someone can help me solving this it would be very appreciated.
New getting started guide for WebXR and Unity (+XR Interaction Toolkit). All you need to make it work in a game jam.
https://youtu.be/4wQG8_pb3cs
Getting started guide for WebXR Export and XR Interaction Toolkit in Unity, January 2024 Edition.
Base project uses:
Unity OpenXR package, Unity XR Hands package, XR Interaction Toolkit package and URP.
The base scene is from XR Interaction Toolkit Starter Assets sample.
Links from the video:
WebXR Export - https://github.com/De-Panther/unity-...
Well done
Hey guys, getting this error when I try to run my WebGL game on Itch.io but I don't get the error on desktop browsers. Same thing for all apps.
Blocked a frame with origin “https://myitchaccount.itch.io”/ from accessing a frame with origini “https://html-classic.itch.io”/ Protocols, domains, and ports must match.
Anyone have any ideas?
Looks malformed to me. .xn--io-02t isn't a valid domain name.
Ah, weird. ACE prefix for internationalized domain names. You learn something new every day
@charred briar I just wrote that to get rid of the personal info
That's not the actual url
the url is the itch profile
@charred briar this is the error
Yeah it won't allow cross domain access. Not sure why itch.zone is being accessed
I'm not familiar with web as I'm usually a mobile / desktop dev. Do you have any advice on how I can move forward with this?
Hmm looks like it's a Google Cloud bucket
</Error>```
I've never seen our itch pages for our games generate that error before, but if it is an itch redirect of sorts, it looks like an itch bug to me
One thing that may be a clue is that it works on desktop safari but not on mobile.
Yeah it'll work in some browsers, it's the browser blocking it, trying to stop you from getting a fishing site pretending to be itch.
Right that makes sense.
Although in this case it looks like it is itch they just didn't configure something
It looks like where they dump your html files to once you upload a build
I was thinking it might be an itch issue so I was going to try to upload to to github pages but my LFS is broken lmao
batch response lfs denied
Got any other sites like itch I can try by any chance?
I've gone through several iterations with my video-centric webGL game. I'm using Visual Studio, not Unity as it is quite a simple build. The constant error I recieve in the web console upon testing on
I might just ask my client if I can get access to his web server to upload the build instead of using itch. I'm only using itch to test.
Could single out the issue if its only an itch thing
The app is using firebase and I had to manually add some code to the index.html, im not sure if that can cause hte issue.
But it's just firebase generated auth stuff
This all works in browser on desktop, so i dont see how it could
I'm 95% sure it's itch.io
If you have your own anything though, even dedicated WordPress, you can just ftp it up to test.
Unity also has its own web hosting I think now for web builds
Thanks I'll give that a try.
To your knowledge though are these things I can change or modify in the editor at all?
itch needs to zip and can cointain max 1000 files, keep loading by demand and not atlas scpite maps, simmer got to mutch ads trackings speed gone to low - one ads in side would be accepted but not during all loads, addressables gzip, has it any server side scripts for leaderboard or save gamestand and connect users.
I didn't ask about that
dark mode / light mode feature, i see there, and 13 pages of games can be sorted by category on search. full screen, but embeded can be problematic if some devs dont like to see game moved. search by dev also there, players can not rate without some logins, if game fineshed it schould be able by any player to be rated. stars 50/100, compare more and show us info.
vr just for info to others, mozilla describes that the input controller can be keyboard, mouse, but does it also work webgl if using a gampad controller ( xbox, ps2 controller, ps3, logitech, bluetoth joystick)
What are you talking about?
web xr / vr glasses with a controller instead slow hand detect, using on dark the ps5 controller
I'm still can't figure what you are talking about
build for xr
your title: New getting started guide for WebXR and Unity (+XR Interaction Toolkit). All you need to make it work in a game jam.
but with ps4 controller ( trust me keyboard and mouse would work see mozilla webxr js )
How Mozilla relates to this video or to input?
navigation
lets see here, there are a lot of input options, but why not use the standard of gamepads, https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Inputs
A full WebXR experience isn't just about showing the user a wholly virtual scene or augmenting reality by adding to or altering the world around them. In order to make an experience that's fulfilling and engaging, the user needs to be able to interact with it. To that end, WebXR provides support for a variety of kinds of input devices.
I'm still not getting what you are trying to say.
just simple using a bluetoth gamepad controller and at same way VR as double screen big monitors
I have no idea what you are talking about.
The video was about using Unity with WebXR.
On what part of the video are you commenting?
Add WebXR Input Profiles ( controller types was q )
Ok.
What about this part?
package manager /if sup input system but thats diffrent, continue your way.
"sup"?
if supported input system to work with webxr or any kind of VR (in relation gamepad)
Are you asking?
The Immersive Group of W3C created a database of 3D models and description profiles of XR controllers.
As part of the WebXR API, there's a list of profile names to the connected XR input source.
So when in XR session in WebXR, developers can read this value, check the XR controllers database, and load the relevant model.
This is the repo for the database
https://github.com/immersive-web/webxr-input-profiles
This is the repo for the Unity loader
https://github.com/De-Panther/webxr-input-profiles-loader
WebXR Gamepad assets, source library, and schema. Contribute to immersive-web/webxr-input-profiles development by creating an account on GitHub.
WebXR Input Profiles Loader in Unity. Based on https://github.com/immersive-web/webxr-input-profiles - GitHub - De-Panther/webxr-input-profiles-loader: WebXR Input Profiles Loader in Unity. Based o...
I don't get how mouse/keyboard or PS2/PS3 controller is related here?
Using keyboard and mouse events , in doc they show keyboard WASD
document.addEventListener("keydown", (event) => {
switch (event.key) {
case "a": case "A": avatar.posDelta.x -= ACCEL_X; break;
case "d": case "D": avatar.posDelta.x += ACCEL_X; break;
case "w": case "W": avatar.posDelta.y += ACCEL_Y; break;
case "s": case "S": avatar.posDelta.y -= ACCEL_Y; break;
default: break; }}); // https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint
What is this code? How is it related to this?
And it's not in the link you provided.
https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Inputs //but only the part of keyboard is listed not mouse at Using keyboard and mouse events
A full WebXR experience isn't just about showing the user a wholly virtual scene or augmenting reality by adding to or altering the world around them. In order to make an experience that's fulfilling and engaging, the user needs to be able to interact with it. To that end, WebXR provides support for a variety of kinds of input devices.
This is a Web JavaScript guide for WebXR.
The code sample is from a part that show to JavaScript devs how to use keyboard events.
How is it related to the video or our talk?
What are you trying to say or ask?
the 3 axis of vr could be forwarded by any axis in js, mouse wheel , mouse x,y, question is if first is giong to work with mouse than try with game controller <-- thats the point of interess
Are you asking if you can use keyboard or mouse for input while in XR mode in WebXR?
not the virtual keyaords, but i mean thre real keyboard, real game pad
Are you asking if you can use physical keyboard or mouse for input while in XR mode in WebXR?
yes i am asking (good&fast work of) phyical input controller, like keyboard, mouse, gamepad
Ok, I think that now I got what you tried to ask.
It should work. Depends on the device and browser.
physical bluetooth input controller: first of all keyboard, mouse than gamepad controller ps3 (any brands)
Developers made "virtual desktop" like experiences using WebXR on Quest.
But they didn't use Unity.
The way Unity on web works, should support it.
But I didn't test it.
if you can take bluetoth game controller, i mean they can fly fight simulators, test in VR
Detecting different gamepad types depends on the Operating System and the browser.
If it's detected in the browser not in XR mode, it should be detected in XR mode as well.
But I didn't try it.
let me explain the
left game stick position |__ and the / trigger on side for one hand to config, press on stick
They were positing some kind of chatgpt stuff in channels, including #1157336089242112090 and seemed to be asking people for $5m. Just take it their advise with a grain of salt.
we know some moderators, if they want to nerve, than they ask are you ai talking english, but dont get disturbt focus
how they think there is so mutch of millions of $ i dont really know, even not hope ai to be a money maker machine
Non XR physical devices don't have their Pose in XR.
The sample you mentioned controlled an avatar like it would control it in non-XR
do you mean with ir kinect 2, rig tracking, motion capture, but that are all slow input dev.
what i read is web xr has its own input, but like in that code other inputs can replace and forward, reconfigured.
Looks to me like non English speaker, who try to copy/paste from google translate.
What it says there, that while in WebXR you should still be able to get input from non-XR devices.
Maybe, here is the thread I was talking about: #1199381888461176914 message just saying take the convo with a grain of salt
Yes, looked the same there as well
Well, feel free to ignore my advice then
It's not pertinent to the convo
its ok some people are thinking techinical other social, view perspectives but all do xp
Not ignoring. But thanks 🙂
(I was thinking to stop reply to them, but from time to time they do manage to explain what they are talking about)
we are in topic of input controller, please, let us know is a physical bluetoth game controller supported , for VR webxr
I'm going to heart instead of thumbsup, because I appreciate you trying and being patient with them, and a thumbs up seems dismissive without being supportive
I answered already.
It depends on the Operating System, the devices, and the browser.
It won't detect the Pose of those devices, but it should get the usual input of those devices.
You'll have to try and see if the devices you want to use works.
it has not to be answered now, it can be add in this channel if you get some news about it, thx.
It's not something that I'm going to try.
But if you'll try, you are welcome to update us what devices you used and if it worked.
hello, all creative and beautiful minds across the globe. Today is my 1st day, here.
i have been trying to make a playble ads, and i thought that i will do it with the help of WebGL build. but it is giving a lot of file and i need a single html file. now after spending a lot of time, i am thinking is it even possible to make a playble ad directly from unity/ webgl.
You need a special version of unity.
https://www.reddit.com/r/unity/comments/18z1lmx/can_i_make_playable_ads_with_unity/
Personally I wouldn't use Unity for it
sir, what tool you use.
i have also got this time with luna. is it good? and i want to know your method.
Project Tiny has been discontinued.
I would start looking at native browser game engines/frameworks. Playable ads/instant games tend to also have pretty strict download size and memory requirements which can be hard to hit using engines that haven't been targeting these things for a long time.
Web Game Engines & Libraries: https://www.webgamedev.com/engines-libraries/web-game-engines-libraries
Cocos Creator and Defold may also be better options.
i was wondering if some of you can share how much memory your webgl game uses in the browser and if you had to tweak the build to lower it (mine is currently at 141mb and it feels like a lot)
Not sure which channel best fits this question, but it's a WebGL issue so guessed here?
Is there any alpha download or something I can download with this fix? Or, does anyone have any idea how long it might take before I can try using it?
[I don't fully understand the ticket status]
This issue is severely slowing me down, trying to build ridiculously hacky work-arounds that barely work; so, I am very eager to finally have it.
Reproduction steps: 1. Open the attached "repro_IN-49088.zip" project 2. Open the "Main" Scene 3. Go to "File > Build Settings......
I wouldn't to be honest, I'm not interested in ads. But if i absolutely had to, I'd try phaser or aframe first
Anything small and lightweight. You'd need to check each one to find one with official support however
our project use 350~mb RAM, which causes crashes on iOS older models. anything that is above 300 mb is bad if you aim for mobile platforms. so 140mb is pretty good if you will not increase memory usage in the future.
i see.. my game is a 2d slot machine type game and is 1 scene atm. my assets are all PNGs and i notice they are much larger in unity than they are on the system and im going to compress them further to lower the build size and test memory again
as far as comparison. when i go look at games built on unity on itch.io and snapshot the memory its only 12mb 🤔...
Most likely you have textures that takes most of your memory. Or maybe you using URP and leave too many possible quality settings (low, medium, high) or features you don't need. I strongly suggest to use https://docs.unity3d.com/Packages/com.unity.memoryprofiler@1.0/manual/index.html
which will give you detailed informationabout your memory usage. Have in mind that profiling should be done on build version and not editor, as differences are very big. Also textures and images compression format is very important, as in game you DO NOT sure png. Png will be transformed to format that rendering understand. And mobile and pc uses different formats, at here you can find your png that is 1024x1024 and size of 17 Kb will actually be converted into RGB 32 and will eat 4mb of memory (while compressed with correct compression uses 1mb). More about it here (https://docs.unity3d.com/Manual/class-TextureImporterOverride.html). In most cases textures size and format is main culprits for bug memory usage
thanks alot for this info i will spend the rest of the day improving my textures as much as possible
i had downloaded the memory profiler yesterday but was running it in editor mode and dismissed it when i saw 2gb memory 😅 . didn't know u can do it in build version that will definitely help
there are guide how to do it. The easiest way is to in build settings set it it developer and select autoconnect profiler. Then press Build and Run. this way it will automaticly connect your profiler to Webgl project running on browser.
Hi Friends, I have set custom mouse pointer design in unity webgl and in my page i use a image picker so whenever I open it and then when its close the mouse pointer come back into its normal design, so basically i want to keep my custom mouse pointer when i come bake to unity webgl
Most likely you need to return focus to your WebGL html window. If you press left mouse click on the application it changes to custom one right? if yes you will need to handle that in JS
Another issue with a cursor bracket which is not visible when the inputfield(legacy) is selected
this issue only occur on chrome
what unity version are you using? and how you changing it? just by setting it in Player settings? Are you using any webgl input assets like https://github.com/kou-yeung/WebGLInput ?
Hey guys, how is the build process? Has it been improved or it still takes forever to build a 20 mb project?
Paused on Unity for a while and deciding to come back to work on project...
Can somebody help me figuring out how to call a method from the index.html to unity script?
I've made a method inside the index.html that detects the device when the WebGL app is loading,
after that I need to communicate it to Unity by calling a method called _SetPlatform(int) how can I reach it?
Have Unity call that function instead
wym?
I mean have Unity call that function instead
does it detect all devices without issues?
I don't see how that's related to the question
Im not understanding your solution
Make a jslib function that calls InvokePlatformSpecificMethod, call that function from Unity when the game has loaded
If you need this function to run before the Unity game has loaded, store the result to a variable and retrieve it with a jslib function when you need it
Ok now it makes sense, im ok with calling it once unity finished loading, the only thing I miss is how to get a var in return after having called that method
return 3 instead of setPlatform(3) and so on. Define the extern method as returning int
So assuming I call this method inside a .jslib at start, is it supposed to work or do I miss something?
Well depends how you call it
yup, that should do it
as long as platform is defined somewhere, I'm not sure how strict the jslib file is
oh it works! thanks for the suggestion!
I've never had unity take forever for a 20mb project, I'd suspect the problem is the project.
I just took 20 minutes to build a 20 mb web build...