azesmway / react-native-unity

MIT License
261 stars 61 forks source link

settings unity project #39

Open rbrogi opened 2 years ago

rbrogi commented 2 years ago

Hi All,

I download this repo and in the example folder i find the unity project

is possible to have an info about unity configuration?

I try to open the project with unity 2021.3.8f1 but in the bar menu file there isn't a menu for RN export...

some guys spoke about a readme file but i dont' find that... but i find a older guide: https://github.com/asmadsen/react-native-unity-view

is normal?

can you help me please?

thank you

rbrogi commented 2 years ago

@azesmway Can you explain to me if i need set some option in the editor?

-> i opened the example in Unity editor -> switch android platform -> add IL2CPP, and ARM64

AND?

thanks

azesmway commented 2 years ago

Build Settings 2022-08-23 15-58-47

rbrogi commented 2 years ago

Thank You for your fast help!

rbrogi commented 2 years ago

@azesmway the export work fine but in android studio the android build fail.

I have changed the ndk version: before -> 21.3.6528147 now -> 25.1.8937393

but i have 2 fails:

1 - Execution failed for task ':unityLibrary:BuildIl2CppTask'.

Process 'command 'C:/Users/USER/Desktop/rn-unity/unity/builds/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/build/deploy/netcoreapp3.1/il2cpp.exe'' finished with non-zero exit value 4

2 -

build grandle:

ext { buildToolsVersion = "31.0.0" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "25.1.8937393" }

have any idea?

rbrogi commented 2 years ago

I try your example:

https://drive.google.com/file/d/1W1wiwH7HVMKnWDi6uJN8RqQRmKh7KgTw/view?usp=sharing

https://github.com/azesmway/react-native-unity/issues/34

Execution failed for task ':unityLibrary:BuildIl2CppTask'.

But not compile

rbrogi commented 2 years ago

@azesmway ok now work your source example

The last problem is: from Main screen to Unity Woork fine but when i come back from Unity screen to Main the app make a Crash.

and there is two apk installed with the same name...

Any Suggestion?

Thanks

ihaoh commented 1 year ago

@rbrogi I fixed this issue.

unity/builds/android/unityLibrary/build.gradle


android {
    compileSdkVersion 33
    buildToolsVersion '30.0.3'
    ndkVersion '21.3.6528147' // << add ndk version!

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVer