Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gilzoide/webgljsinjector
Import JavaScript code as <script> tags in Unity WebGL builds' index.html file
https://github.com/gilzoide/webgljsinjector
postbuild script unity web webgl
Last synced: about 2 months ago
JSON representation
Import JavaScript code as <script> tags in Unity WebGL builds' index.html file
- Host: GitHub
- URL: https://github.com/gilzoide/webgljsinjector
- Owner: gilzoide
- License: unlicense
- Created: 2022-06-12T19:53:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-12T19:58:57.000Z (over 2 years ago)
- Last Synced: 2024-11-10T15:07:18.649Z (3 months ago)
- Topics: postbuild, script, unity, web, webgl
- Language: C#
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WebGL JS injector
Import JavaScript code as `` tags in Unity WebGL builds' `index.html`
file.This is a simpler alternative for HTML templates when you only need custom
`<script>` tags.The new tags will be placed right before the last `<script>` tag found in the
HTML file, in the same order that they are found by `AssetDatabase`.## Installing
Install via [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui-giturl.html)
using this repository URL:
```
https://github.com/gilzoide/WebGlJsInjector.git
```## Usage
1. Create a file with the `.jstag` extension inside your `Assets` folder or UPM
packages
2. (Optional) Add JavaScript code to this file, which will go inside the tag:
```html
<script>
Code will go here```
3. (Optional) Add attributes in the import settings, which will go in the tag.
Example of attributes are `type="module"` and `src="URL of some js lib in a CDN"`
```html
...
```
4. Build for WebGL ðŸ›
5. (Optional) Open your `index.html` file in your code editor of choice to
check that the expected `` tags are there
6. Enjoy 🎉