FirebaseWebGL icon indicating copy to clipboard operation
FirebaseWebGL copied to clipboard

unityinstance is not defined

Open AyushShreshthi opened this issue 2 years ago • 3 comments

I added unitypackage in the project and then call functions for auth and build WebGL, then I added my firebase config to the built index.html file and this.unityInstance = unityInstance line also, then I uploaded the build zip file on unity play. but now I am getting an error called: unityinstance is not defined. is there something I am missing or to add? Please help.

AyushShreshthi avatar Jul 12 '22 10:07 AyushShreshthi

same here, encountering this issue.

DNAniel213 avatar Feb 16 '23 03:02 DNAniel213

@DNAniel213 @AyushShreshthi

Hello, You can fix that issue using this code:

	onload = () => {
		createUnityInstance(canvas, config, (progress) => {
		}).then((unityInstance) => {
			this.unityInstance = unityInstance;
		}).catch((message) => {
			alert(message);
		});
	};

Add that script to js file or in html code. It would be best to place the code under buildUrl. EXAMPLE:

Screenshot_291

I hope I helped ! :)

Antonio-Gorisek avatar Aug 20 '23 12:08 Antonio-Gorisek

Thanks @Antonio-Gorisek

AyushShreshthi avatar Aug 22 '23 02:08 AyushShreshthi