People who code: we want your input. Take the Survey
4

According to an answer on Unity Answers, you need to put the scripts used for building into a folder named Editor (specifically, ./Assets/Scripts/Editor). Here's a full working build script: using UnityEditor; using UnityEngine; class BuildSrcipt { static string[] scenes = { "Assets/Scenes/MyScene.unity" }; static string name = "MyGame"; [...


4

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 JavaScript file which defines the functions you need and implements them by calling native browser functionality. Give it the file extension .jslib Put it into ...


4

Got it working with the following LoadBundle method: IEnumerator LoadBundle(string bundleName, UnityAction<AssetBundle> callback) { string path = Path.Combine(Application.streamingAssetsPath, Directory, bundleName.ToLower()); Debug.Log(path); #if UNITY_WEBGL && !UNITY_EDITOR UnityWebRequest request = UnityWebRequestAssetBundle....


2

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 quite large, so a sprite that's just 1 unit farther away would need to double in size to match it. That means you saturate your upper scaling limit almost ...


2

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 engine will spend some measurable time calling it. So, we'll take the LateUpdate method off of our individual instances, and instead just task them with tracking a shortlist of the instances we care ...


2

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 within the project, in the StreamingAssets folder, using Application.streamingAssetsPath, but that is irrelevant to your needs. As for the extra credit, you can run ...


2

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 "Use Instant Games" in the Instant Games settings to have a facebook web game, not instant game. If you run across the "Games must reference one of our supported ...


2

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 users on iPhone and iPod devices will be unable to take advantage of true fullscreen functionality, though you can get quite close by prompting users to add your ...


1

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 ever see in your feed was these spammy incentivized share posts. See https://webapps.stackexchange.com/questions/77969/is-rewarding-users-for-sharing-using-...


1

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, then Unity actually starts a tiny webserver to host the game, so your browser can load the game from http://localhost/. So when your testers want to do that too, they need to set up a local ...


1

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 variable. Restarted the system and created new unity project and ran the webgl build.


1

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 photoshop before, Unity converts those PNGs in a unity readable format which of course have another file size based on the import settings you are using. In ...


1

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, and reject implausible play, stopping it from recording a high score. For instance, if your client & server can both agree on the same sequence of enemy ...


1

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 should start and end at. const float startlooptime = 11.875f; const float endlooptime = 74.375f; public override void MatchStarted() { Loop.Play(); } void ...


1

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 accessing that font file and not the default font, I renamed it "_Arial". Still didn't work. Then while looking at the Unity Documentation, I noticed this: Font ...


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