Closed meds closed 6 years ago
I've followed the example provided on the main page, on the React end:
import React from 'react'; import { RegisterExternalListener } from 'react-unity-webgl';
export class App extends React.Component { constructor () { RegisterExternalListener ('OpenMenu', this.openMenu.bind (this)); } openMenu (menuId) { console.log (`opening menu with id ${menuId$}`); } }
and in Unity I have this:
using UnityEngine; public class MenuController: MonoBehaviour { [DllImport("__Internal")] private static extern void OpenMenu (string menuId); public void OpenReactMenuById (string menuId) { OpenMenu (menuId); } void Start(){ OpenReactMenuById("ok"); } }
but when I run it I get an error saying the function couldn't be found:
missing function: OpenMenu printErr @ UnityLoader.js:1 _OpenMenu @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 xkl @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:10760 wkl @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:10759 SAj @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:4284 Fyl @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:32712 invoke_iiiii @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 off @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:28758 ahf @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:12699 m$ @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:12694 l$ @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:11614 fKa @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:20766 aKa @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:14401 xFb @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:14404 eVa @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:21179 ULb @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:21510 bIb @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:14576 RHb @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:14565 Szl @ blob:http://localhost:8080/a767f7e9-e581-4cbd-b3de-ab5a3586c7d8:32779 browserIterationFunc @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 runIter @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 requestAnimationFrame (async) requestAnimationFrame @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_scheduler_rAF @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2 Browser_mainLoop_runner @ blob:http://localhost:8080/13c645fc-9b9b-4f3f-8827-d5cf3c79c08b:2
Any ideas?
Closed as an exact duplicate of https://github.com/jeffreylanters/react-unity-webgl/issues/11
I've followed the example provided on the main page, on the React end:
import React from 'react'; import { RegisterExternalListener } from 'react-unity-webgl';
and in Unity I have this:
but when I run it I get an error saying the function couldn't be found:
Any ideas?