[Solved FAQ] Reference error: UnityHooks its not defined
Hello! i managed to make a build on the demo project, at the branch dev/refactor4, but when i test it i have this errors:

i make the build on Unity 2021.3.4f1
Is this error is unity version specific? Any specific unity version where this error is not coming? I used 2019.4.6f1 and I got the error.
Any lead for this will be helpful.
@Mallo-Lucas did you choose AgoraTemplate2020 for building the project? @BavishiDhruvil did you choose AgoraTemplate to make the build?
Have you look at the README files regarding building and running projects with the SDK? If setting the template doesn't work for you. Then try to start fresh with your project and try to import the SDK again.
Any one encounter the same issue - make sure you have a clean project that previous cache of WebGL SDK is not present. I will keep this issue open for 30 days before closing it.
@BavishiDhruvil did you choose AgoraTemplate to make the build?
Yes. I have.
Try start your project clean without the SDK and then import it.
replace
// Runtime.dynCall('viiiii', UnityHooks.OnStreamMessageCallback, [uid, 0, data, length]);
by
Module['dynCall_viiiii'](UnityHooks.OnStreamMessageCallback, uid, 0, data, length);
noitice 5 letters i
@BavishiDhruvil I've pushed the change that @tuannhanle suggested. Would you please try it out on branch dev/refactor5?
@BavishiDhruvil I've pushed the change that @tuannhanle suggested. Would you please try it out on branch dev/refactor5?
Checking this.
@icywind @tuannhanle This works fine with 2019.4.6f1 is working fine. But still the same error in 2020.3.18f1 is having the same error.
Really appreciate your help.
Thanks, Dhruvil
I have the same error. I'm using Unity 2021.2.7f. I also tried the dev/refactor5 branch but without results.
I would appreciate any help on this matter
Unity 2019.4 works fine but Unity2020/Unity2021 doesn't want to work with AgoraTemplate2020
@BavishiDhruvil @icywind Can you help with this?
If I remove any mention of "UnityHooks"
I get this error
Hi team,
I still face this problem on Unity 2021.3.8 and SDK v4.13.0-special.0-0-g967eedaf

Debug.Log("11111");
InitGameObject();
Debug.Log("2222");
InitEngineCallback();
Debug.Log("33333");
as you can see.. it fail when calling InitEngineCallback inside IRtcEngine
@BinhTopebox are there any modification to the webgl build template? What if you build and run the demo or any of the API-examples?
@icywind I just tried to build the demo and still get the same error. I have no modifications to the webgl build template

I have the same problem... pls solve thanks
Hi guys, I managed to solve the problem. The problem was that I was using git project instead of unitypackage from realease section. As soon as I created a new Unity project and imported the unitypackage, the error disappeared.
Hope this helps someone
Would you share any changes after you imported this package again? maybe I changed setting at SDK that couldn't able to build in WebGL
After I completely remove the sdk, clear all unity cache, then reimport the sdk, it works like a charm.
Thank @Klaus1991, you saved my life :)
Hi guys,
I am getting error in 2020.3.18 version.
Uncaught ReferenceError: unityFramework is not defined at r.onload
Any idea? I have created afresh project and imported the package from release.
Thanks, Dhruvil
I have a related issue.
When I run the build locally it works great.
When I upload the build to simmer.io (a Unity WebGL hosting site), I get the UnityHooks not defined.
I don't know what would be different between running it locally and running it from that server.
Ideas?
@tpitman no idea. As we have not gotten the chance to use simmer.io yet. If you found out something please share with the people. TIA!
Looks like simmer replaces the template with their own.
I am working with the dev to fix that.
I uploaded to github pages and that works.
Thanks
On Wed, Nov 2, 2022 at 6:04 PM Rick Cheng @.***> wrote:
@tpitman https://github.com/tpitman no idea. As we have not gotten the chance to use simmer.io yet. If you found out something please share with the people. TIA!
— Reply to this email directly, view it on GitHub https://github.com/AgoraIO-Community/Agora_Unity_WebGL/issues/116#issuecomment-1301507331, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWFTQ46IORLX3VQ4TPH2VLWGL6QBANCNFSM523OHA7Q . You are receiving this because you were mentioned.Message ID: @.***>
@tpitman good to know, thanks! As a hint for the other developers, the UnityHook not defined error is usually something related to the template not being loaded properly. In some other cases, such as wrapping the Unity WebGL build inside a React Native framework, could also cause the error. So the effort here is ensure the jslib and the included js source file are loaded and visible in that framework.
Thanks!
On Wed, Nov 2, 2022 at 6:09 PM Rick Cheng @.***> wrote:
@tpitman https://github.com/tpitman good to know, thanks! As a hint for the other developers, the UnityHook not defined error is usually something related to the template not being loaded properly. In some other cases, such as wrapping the Unity WebGL build inside a React Native framework, could also cause the error. So the effort here is ensure the jslib and the included js source file are loaded and visible in that framework.
— Reply to this email directly, view it on GitHub https://github.com/AgoraIO-Community/Agora_Unity_WebGL/issues/116#issuecomment-1301510290, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWFTQ7BONKADOEK4QHZT2LWGL7E5ANCNFSM523OHA7Q . You are receiving this because you were mentioned.Message ID: @.***>