unityContext.send not sending. #304
Replies: 5 comments 4 replies
-
This happened to me as well. Adding a setTimeout of 1 second helped fix the issue. Looks like Unity WebGL isn't ready to call a method the instant it has been loaded. |
Beta Was this translation helpful? Give feedback.
-
This example didn't work for me either when transferring data from unity to React. I redid the example from version 7 and everything worked out ! HandleClick.cs (attaches to any object in the scene) using System.Collections; using System.Runtime.InteropServices; // for DllImport public class HandleClick : MonoBehaviour
} auxiliary scripts [System.Serializable] SendMouseCoords.sc [System.Serializable] ConnectToReact.jslib mergeInto(LibraryManager.library, { DemoUnityToReact: function(busStr) { MouseCoordsToReact: function(allCoordsStr) { |
Beta Was this translation helpful? Give feedback.
-
Yes!) this option works with version 8 of the library [email protected] . const unityContext = new UnityContext({ function App() { // useEffect(function () { // }, []); {/* */} <Unity unityContext={unityContext} style={{ height: 700, width: 1200, border: "2px solid black", background: "grey", }} /> ); } export default App; |
Beta Was this translation helpful? Give feedback.
-
Thank you for your Wonderful library!) Now the event is triggered when the left mouse button is pressed. I will later try to call sending a message from Unity using the Start() function. |
Beta Was this translation helpful? Give feedback.
-
@jeffreylanters |
Beta Was this translation helpful? Give feedback.
-
Hello, just another quick problem that's probably easy to solve.
My unity loads fine and everything, even though the screen is really really tiny (and I don't know why)
I'm trying to call a function as soon as unity loads. However it doesnt seem to be getting called (is this a timing issue?)
I get the console.log("Send Code") but I never receive the log from unity.
The JS code
And the c# code I'm trying to call
Beta Was this translation helpful? Give feedback.
All reactions