unity-webgl

How do I clean up and unload a Unity WebGL canvas when changing page

依然范特西╮ 提交于 2019-12-06 07:18:07
问题 I've got a problem on my web application when I am changing the current page after downloading and running a Unity WebGL game. In fact, I know for sure that the game is running because I continuously hear the sounds when my player is dying. Is there a way to delete all of the context when changing a web page? Could this be a kind of memory leak? Edit 1: My web application is done with AngularJS / Material 回答1: The solution is simple: load the WebGL unity in an iframe , this sandboxes the

Importing a Unity WebGL-project into an Angular2 component

天大地大妈咪最大 提交于 2019-12-05 10:16:32
I'm looking to integrate a Unity WebGL-project into an Angular2 app. What's the proper way to move all this script into an Angular2 component? First, the Unity WebGL exports an index.html like this: <!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unity WebGL Player | Espoo web manager (Prefab preview)</title> <link rel="shortcut icon" href="TemplateData/favicon.ico"> <link rel="stylesheet" href="TemplateData/style.css"> <script src="TemplateData/UnityProgress.js"></script> <script src="Build

Can I create a game for webgl without the Unity logo?

那年仲夏 提交于 2019-12-02 07:09:31
问题 Can I create a game for webgl without the Unity logo when I download and without title "Unity webGL"? . example 回答1: According to the docs you need a Pro license to remove the splash screen. (the logo in the middle of the screen) As for the frame around the game that's easy to change, just change the HTML as documented here. You can choose either one of the defaults or create your own template. According to those docs you create folder in Assets called WebGLTemplates and inside that create a

Can I create a game for webgl without the Unity logo?

大兔子大兔子 提交于 2019-12-02 05:39:29
Can I create a game for webgl without the Unity logo when I download and without title "Unity webGL"? . example gman According to the docs you need a Pro license to remove the splash screen . (the logo in the middle of the screen) As for the frame around the game that's easy to change, just change the HTML as documented here . You can choose either one of the defaults or create your own template. According to those docs you create folder in Assets called WebGLTemplates and inside that create a new folder for your template like BetterTemplate . Inside that put an index.html file and any other

Find a nearest/closest point on a GameObject from location?

放肆的年华 提交于 2019-12-01 05:44:47
问题 I want to find out a point on boom section from load hanging on crane which have minimum distance from load, crane-Boom having BoxCollider on hit and I am using Physics.overlap method. How do you find a closest point on a GameObject from source object? [1]: https://i.stack.imgur.com/ZBRqm.png 回答1: You can do that with Collider.ClosestPoint and Collider.ClosestPointOnBounds. If you also want to check for custom position and rotation instead of using the collider's postion and roation then use

Application.streamingAssetsPath and WebGL build

半世苍凉 提交于 2019-11-29 15:34:26
In a project I'm working on I have two json files in the StreamingAssets directory. The script that handles them works perfectly in a Standalone PC build but doesn't work at all in a WebGL one. I'm getting the "Cannot find file!" message according to the script: else if (!File.Exists (filePath)) { Debug.LogError ("Cannot find file!"); } I was given the answer to use the WWW class as described in the scripting API on Unity Technologies site at this address: https://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html using UnityEngine; using System.Collections; public class

Unity3D - Upload a image from PC memory to WebGL app

风流意气都作罢 提交于 2019-11-27 02:28:07
问题 I need user to upload his(her) avatar picture from PC to game How can I create a file dialog and upload a image to WebGL game? 回答1: Today is your lucky day :P I took up your challenge. Here's how you do it. First off the instructions on how to interface JavaScript with Unity are here. Reading that I made this file which I put in Assets/Plugins/WebGL/GetImage.jslib like the docs said var getImage = { getImageFromBrowser: function(objectNamePtr, funcNamePtr) { // Because unity is currently bad