Search Unity

Unity & React Native

Discussion in 'General Discussion' started by marijnz, Feb 4, 2018.

  1. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
    As a fun side-project, I got Unity and React Native working besides each other on Android. In case you want to have native elements on top of your Unity game, this could be something (but probably not worth the dependency hell..). It's a one button click to create a build and it should be easy to extend the Unity or React Native projects.

    Most time was spend on getting all of the dependencies to work together. I initially wanted to make the React Native code part of the Unity build through an exported .aar with gradle. But it turned out to be a lot simpler to export the Unity project as a gradle project, and rather include in the React Native gradle build. No. 1 reason for this was the extra control that came from building through gradle, such as avoiding 64 bit libraries being included.

    Feel free to build further on it and let me know what you think :)

    https://github.com/marijnz/unity-react

     
    nicloay and Jamster like this.
  2. peekame

    peekame

    Joined:
    Jul 11, 2018
    Posts:
    3
    Can I email you? Working hard on this issue now and blocked .
     
  3. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
    Sure marijn[at]marijnzwemmer.com
     
  4. yurykorzun

    yurykorzun

    Joined:
    Oct 29, 2015
    Posts:
    41
    Have you tried adding RN to Unity 2018 and 2019?
     
  5. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
    I haven't tried but you could just take the project and try it with latest Unity?
     
  6. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Nice work! What's the performance like?
     
  7. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    @marijnz I have a question.

    In a react native app you typically have a <TextInput> and you type in some text.


    but when you click back to the home screen then click back on the app the text is still there.

    Is there any way to reset the state back to original as soon as you tap the app icon?

    I heard componentDidLoad() is being deprecated.

    Thanks in advance.
     
  8. marijnz

    marijnz

    Joined:
    Sep 20, 2012
    Posts:
    67
    I didn't measure. I didn't see this as a thing as the overhead of having native elements should be very small.

    Hey, that's a very specific thing that I don't know of. You can just attach some callback to the app getting opened/brought to the foreground and clear the data? Not sure if I get your qustion.
     
    iamthwee likes this.
  9. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Hey thanks for the reply, sorry if it is not quite related to react and unity.

    But here's the thing.

    I've deployed / built an app to ios. I put data inside a text field, when I click off the app and somewhere on the home screen, but then go back into the app, that text is still there in the field.

    How would you reset all data inside an app, regardless of how many components there are. Appreciate the reply, just I don't know the answer?
     
  10. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Last edited: Jun 23, 2019
  11. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    @marijnz what are you thoughts about 'react-navigation' vs 'react-native-navigation' -> rolled out by wix.

    I'm about to roll out a navigation system but would appreciate your feedback if you have experience in the two options so I can pick the most suitable option.
     
  12. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    also what are your thoughts on google flutter?
     
  13. yurykorzun

    yurykorzun

    Joined:
    Oct 29, 2015
    Posts:
    41