11 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 ...
  • 117k
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 ...
6 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 ...
  • 113k
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 ...
  • 113k
4 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, ...
  • 183
4 votes
Accepted

How to use AssetBundles with Unity WebGL

Got it working with the following LoadBundle method: ...
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 "...
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 ...
  • 117k
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 ...
  • 36
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 ...
  • 5,189
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 ...
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 ...
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 ...
  • 3,763
1 vote
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, ...
  • 113k
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 ...
  • 117k
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 ...
  • 113k
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 ...
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 ...
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, ...
  • 117k
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 ...
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 ...
  • 179

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