-
Notifications
You must be signed in to change notification settings - Fork 50
Communication between Unity and React
Gökhan Kurt edited this page Apr 14, 2020
·
3 revisions
Although there are different ways to do this for advanced use cases, the easiest way to do it is by using NamedAssets.
NamedAssets is a dictionary of assets you can send over to the React side from the Unity side.
You can set NamedAssets in the inspector:

After assigning, you can access your object in React side via the NamedAssets global variable. Here is an example script using NamedAssets. You can download the full sample project and go to "Interop" scene to see this in action.

Note: You can set/get an object's public properties and call its public methods from React side. However, if you try to set/get a non-existing or non-public property/method, you will get an error.