WebGL JS Injector
Import JavaScript code as <script> tags in WebGL builds' index.html file
com.gilzoide.webgljsinjector Unity Compatibility
Unity 6 Not tested
2023.2 Not tested
2023.1 Not tested
2022.3 LTS Not tested
2021.3 LTS Not tested
2020.3 LTS Not tested
2019.4 LTS Not tested
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/webgljsinjector.git 
README Markdown
Copy this to your project's README.md
## Installation
Add **WebGL JS Injector** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/webgljsinjector.git
```
[](https://www.pkglnk.dev/pkg/webgljsinjector)README
WebGL JS injector
Import JavaScript code as <script> 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 using this repository URL:
https://github.com/gilzoide/WebGlJsInjector.git
Usage
- Create a file with the
.jstagextension inside yourAssetsfolder or UPM packages - (Optional) Add JavaScript code to this file, which will go inside the tag:
<script>
Code will go here
</script>
- (Optional) Add attributes in the import settings, which will go in the tag.
Example of attributes are
type="module"andsrc="URL of some js lib in a CDN"
<script Attributes will go here>...</script>
- Build for WebGL 🛠
- (Optional) Open your
index.htmlfile in your code editor of choice to check that the expected<script>tags are there - Enjoy 🎉
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In