The Unity WebGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering API to run Unity content in a web browser. To illustrate the use of the template tags, here is the HTML source that Unity uses for its default webplayer build.This page details the Player settings specific to the WebGL A JavaScript API that renders 2D and 3D graphics in a web browser. The textbox next to the tag’s name contains the text that the custom tag will be replaced with during the build. …is added to the source, the Player Settings will look like this:. UNITY_CUSTOM_SOME_TAG: If you add a tag to the index file with the form UNITY_CUSTOM_XXX, then this tag will appear in the Player Settings when your template is selected. UNITY_BETA_WARNING: If the webplayer has been built with a beta version of Unity, this tag will be replaced with a short warning message about the fact. UNITY_UNITYOBJECT_DEPENDENCIES: The UnityObject2.js file has dependencies this tag will be replaced with those dependencies. This tag provides the URL that will be used to download the file. UNITY_UNITYOBJECT_URL: By default, the webpage will download UnityObject2.js from Unity’s website as necessary (ie, the Offline Deployment option is disabled). This tag provides the local path to the UnityObject.js file, which will be generated if the Offline Deployment option is enabled in the Build Settings. However, this requires an internet connection and causes problems if the page is to be deployed offline from the user’s hard drive. This is normally supplied to a page by downloading from Unity’s website. UNITY_UNITYOBJECT_LOCAL: A browser JavaScript file called UnityObject2.js is generally used to embed the player in the host page and provide part of the interaction between Unity and the host’s JavaScript. UNITY_WEB_PATH: Local path to the webplayer file. UNITY_WIDTH and UNITY_HEIGHT: Onscreen width and height of the player in pixels. The complete set of tags is given below:. …in the host page generated for the build. …in the template’s index file will be replaced with MyPlayer For example, if the product name is defined as “MyPlayer” in the Player settings:- %UNITY_WEB_NAME% The tags are delimited by percent signs (%) in the page source. These include the name, onscreen dimensions and various other useful information about the player. Template Tagsĭuring the build process, Unity will look for special tag strings in the page text and replace them with values supplied by the editor. The thumbnail image will be displayed in the inspector to hint at what the finished page will look like. Optionally, the folder can contain a file named thumbnail.png, which should have dimensions of 128x128 pixels. (the name of the template will be the same as its folder). Once created, the template will appear among the options on the Player Settings inspector. Each template folder contains an index.html or index.php file along with any other resources the page needs, such as images or stylesheets. Structure of a Webplayer TemplateĬustom templates are added to a project by creating a folder called “WebPlayerTemplates” in the Assets folder - the templates themselves are sub-folders within this folder. Unity allows you to supply your own pages to host the player by using webplayer templates. For example, if the Unity content interacts with other elements in the page via the external call interface then it must be tested with a page that provides those interacting elements. The built-in HTML pages are fine for testing and demonstrating a minimal player but for production purposes, it is often desirable to see the player hosted in the page where it will eventually be deployed. There are actually three different variations of this page which can be selected from the Player Settings inspector (menu: Edit > Project Settings > Player). The default page is very simple, with just a white background and some minimal text. When you build a webplayer project, Unity embeds the player in an HTML page so that it can be played in the browser.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |