Is there any convinent way to sync data between unity and react? #51
-
i'm new to unity and this library,please don't mind my stupid questions : I have 2 questions, please help me if you can:
thanks for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey. Do not worry, your question is very valid and was asked many times. It is a topic that should be in the documentation but I didn't have time to do it yet.
However, this will only rerender on changes to the But there is also a mechanism to handle that. It is called watchables and it is similar to Globals. You can use it like: C# side:
React side:
|
Beta Was this translation helpful? Give feedback.
Hey. Do not worry, your question is very valid and was asked many times. It is a topic that should be in the documentation but I didn't have time to do it yet.
DemoManagerScript
directly to the globals, like this:Globals
to cause a rerender, you need to useuseGlobals
.However, this will only rerender on changes to the
Globals
itself, not its nested properties. For example, if you changeusername
ofDemoManagerScript
, it won't cause a rerender. To do that, you can set it in Globals manually likeGlobals["username"] = username
.But there is also a m…