Skip to main content
12 votes

Performance degrading when resolution increases for a 4k screen

One way to limit the resolution of your game is to have your camera render to a RenderTexture. You can create a RenderTexture in script to match the current aspect ratio of your window/screen, or even ...
DMGregory's user avatar
  • 135k
8 votes
Accepted

How can I use websockets in a Unity WebGL project?

As the documentation says, The Unity scripting API does not expose direct WebSocket access itself. But you can access the native web browser API by calling JavaScript from Unity C# scripts. Create a ...
Philipp's user avatar
  • 120k
6 votes

Performance degrading when resolution increases for a 4k screen

The text & button size issue can be addressed by changing the Canvas Scaler component on the canvas to a mode other than Constant Pixel Size: In Scale With Screen Size mode, you set a reference ...
Acme Nerd Games's user avatar
5 votes

Performance degrading when resolution increases for a 4k screen

I know that you tagged the question as unity-webgl, but some people might find this question while developing a desktop game and might find this answer useful: For a desktop game, you can use the ...
Philipp's user avatar
  • 120k
5 votes
Accepted

Build Unity from C# script

According to an answer on Unity Answers, you need to put the scripts used for building into a folder named Editor (specifically, ...
piegames's user avatar
  • 203
4 votes
Accepted

How to use AssetBundles with Unity WebGL

Got it working with the following LoadBundle method: ...
Jasper Citi's user avatar
3 votes

Unity Facebook WebGL build... Does this work or not?!?! Getting conflicting answers

In case anyone comes across this and was confused like I am- Facebook no longer separates Web Hosting from Instant Games; to upload a build, upload it under Instant Games/Web Hosting, then disable "...
Angela He's user avatar
2 votes
Accepted

Create and serve AssetBundle at runtime

You don’t seem to have a lot of questions here, so I’ll answer the ones I see. Loading an asset bundle from a web server using a normal http/s URL works just fine. It can also load bundles from ...
Ed Marty's user avatar
  • 5,229
2 votes
Accepted

Improving FPS by disabling unity events

The best way to skip calling a MonoBehaviour message is to not declare it. As long as your script has a method called LateUpdate and your script is enabled, the ...
DMGregory's user avatar
  • 135k
2 votes
Accepted

How do I share a downloadable WebGL build in Unity?

The Unity WebGL builds are intended to be played from websites. They don't work when loaded from a file:/// url. When you launch a WebGL build from inside Unity, ...
Philipp's user avatar
  • 120k
2 votes
Accepted

WebGL game won't go into fullscreen mode on iOS devices

It looks like you've encountered a limitation of Safari for iOS, where the Fullscreen API is largely unsupported, being usable only for iPad devices running iOS 12 or later (MDN, caniuse). Safari ...
nqu's user avatar
  • 76
2 votes
Accepted

Character walks too fast when browser's hardware acceleration is turned off

I found the solution. Quoting this discussion thread: "Inputs are provided by the player on a frame-by-frame basis. They never need to be scaled based on framerate, since you don’t want the same ...
vmrfreitas's user avatar
2 votes
Accepted

When loading only one item from the asset bundle in Unity, does the whole asset bundle need to get downloaded?

Yes, the whole asset bundle will be downloaded. A webserver can't look into the asset bundles and deliver just a part of it. It's all or nothing. So if you want to optimize the loading times and ...
Philipp's user avatar
  • 120k
1 vote
Accepted

Compiling Unity to WebGL gives a Node ESM module error

I fixed it by removing "type": "module" from my home directory's package.json. I'm guessing it had something ...
kalilamodow's user avatar
1 vote

What color format, depth buffer should I use in a RenderTexture for WebGL screen output in Unity? Is NPOT ok? MipMaps?

After a great deal of trial and error I have learned a few things. Methodology For each permutation of the factors described in the original question, I created a build using a RenderTexture and ...
Acme Nerd Games's user avatar
1 vote

How can I stop the Unity Video Player on WebGL from starting each video with a frame of all black?

I settled on the following solution: start playback on the waiting player a few frames before the active player finishes its segment. Since I still don't understand what's causing the black screen on ...
verified_tinker's user avatar
1 vote

Can I give prizes based on sharing a WebGL game link on Facebook?

You are not allowed to reward users for sharing, since 2014, because it made for a completely awful experience for all of their friends. Before this rule, if you had a lot of gamer friends, all you'd ...
Kevin's user avatar
  • 6,235
1 vote

Equal 3D icon size visualization in Unity

This code tries to scale objects to the visible size they'd have if they were 1 unit away from the camera. That's awfully close to use as a benchmark size! A sprite that's 1m from your camera would be ...
DMGregory's user avatar
  • 135k
1 vote

Simulate shake, tilt and multi-touch in Unity WebGl app

Tilt to move an object without touching the object. The idea is to "sail" the object from the top of the screen into a basket at the bottom avoiding some obstacle on the way. Tilt to cause ...
Philipp's user avatar
  • 120k
1 vote

Webgl build error in unity

This is what worked for me: Uninstalled nodejs from the system along with the path from environment variable. Reinstalled nodejs in the C drive program files and added the new path in environment ...
single arrow games's user avatar
1 vote

Assets bundles have higher size than uncompressed sprites

Thanks for your answers, actually you guys gave me a hint of what's going on here and I've found out the solution for this. Well, it happens that it doesn't matter if you compress your PNG files with ...
roseicollis's user avatar
1 vote

Unity WebGL audio not looping when started with playdelayed()

Ok here is my workaround. I added the intro and loop together into one file. I also added on a little bit more of the start of the loop onto the end, and I made a note of exactly what time the loop ...
Guye Incognito's user avatar
1 vote

Font Changes in WebGL Build

I just managed to solve the problem in a very weird way. I initially brought an Arial font file into the project and replaced all text object fonts with this. It didn't work. To make sure it was ...
JSparks's user avatar
  • 199
1 vote

How to copy text from an InputField to the clipboard in WebGL?

I don't know if this works well but an attempt at a solution is to use the browser's copy and paste events. In paste pass that into Unity and append to the current InputField. On copy ask the ...
gman's user avatar
  • 840
1 vote
Accepted

Keeping score server side to prevent cheating

Don't send scores. Send game events as they happen, and calculate the score that results from those game events. The server can then validate whether the claimed sequence of game events is plausible, ...
DMGregory's user avatar
  • 135k

Only top scored, non community-wiki answers of a minimum length are eligible