Skip to content

Unable to Send Message while Unity is not Instantiated. #474

@heymangal

Description

@heymangal

Please avoid duplicates

Language and Compiler

Vanilla JavaScript

What environment are you using?

Local Development Server

When does your problem occur?

When the Unity App is running

What does your problem relate to?

The problem seems React related

React-Unity-WebGL Version

9.3.0

React Version

17.0.39

Unity Version

2021.5f1

What happened?

Hello team, I am sorry to say that I am facing runtime issues within react, I have been trying to solve it for some days but without success.

  1. Image 1 https://drive.google.com/file/d/1X51vftlknpMB-kGqxvlNWk8a5f8Sbzm4/view?usp=sharing

WebGL Warning Log : When Call Unity Function Using Bridge :
**use-unity-context.js:121 Unable to Send Message while Unity is not Instantiated.
(anonymous) @ use-unity-context.js:121**

  1. I call Unity React functions directly from Unity Listener.
    https://drive.google.com/file/d/1tttT2moMFzI8SN7M1LmG8zv4RNq7oI89/view?usp=share_link

3.And this function is called from the listener. And within it Unity communicates with SendMessage
https://drive.google.com/file/d/1xc00kEi81-y-yA3bX0wnyWNL230fZYvg/view?usp=sharing

  function ClickedConnectVenly() 
  {
    sendMessage(
      "Persistent",
      "Loader", false
    );
  }

But I get This Message in WebGL Log Console and not Send Message Unity Function: (All The Parameters are Verified)

WebGL Warning Log : When Call Unity Function Using Bridge :
**use-unity-context.js:121 Unable to Send Message while Unity is not Instantiated.
(anonymous) @ `use-unity-context.js:121**`
  1. Calling Function From React Button
    https://drive.google.com/file/d/1pNFwVxxZq9_ELmniYFHDWUc91YuUUTWE/view?usp=sharing

And now , if I call this function from react button then it works fine. But if I call from unity listener, it doesn't give me function call inside unity.

I don't know if this is an issue or my coding.

Help me Please !

Reproducible test case

No response

Would you be interested in contributing a fix?

  • yes, I would like to contribute a fix

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions