azesmway / react-native-unity

MIT License
262 stars 61 forks source link

Unity Jar issue with Unity Version 2023 #116

Open rmethaniya opened 4 months ago

rmethaniya commented 4 months ago

System Configuration Mac Mini 2023 Apple M2 chip MacOS: 14.1.1 (23B81)

Unity Version I tried with 2 different unity version which is 2023.2.5f1 and 2023.2.20fa

Package.json @azesmway/react-native-unity: 1.0.7 react-native: 0.73.6

Unity Player Build Settings Minimum API Level :Android 8.0 'Oreo' (API level 26) Target API Level: API Level 34 Target Architecture: ARM64

Issue When I export the build and try run android app then getting error: 'UnityPlayer' is abstract; cannot be instantiated

327111489-16159800-c828-454a-97ad-2e47835727ba

cf-moritzjaeger commented 4 months ago

I am having the same problem with unity 6000.0.0f1

cf-moritzjaeger commented 4 months ago

Looking into this, it seems the UnityPlayer class has been made abstract and replaced with the class UnityPlayerForActivityOrService from Unity 2023.1 on.

See: https://docs.unity3d.com/2023.1/Documentation/Manual/UpgradeGuide20231.html

rmethaniya commented 4 months ago

Absolutely! It's time to update the implementation within the library. https://github.com/azesmway/react-native-unity/blob/main/android/src/main/java/com/azesmwayreactnativeunity/ReactNativeUnity.java

For now I am using Unity 2022 version and it is working

cf-moritzjaeger commented 4 months ago

Yes, I did the same. For me it is now also working with 2022.

Though I also just found a fork of this repo that has updated the code to work with 2023. https://github.com/byplay-io/react-native-unity

But to implement this in the main repo, there probably would need to be a more complex implementation that supports version pre 2023 as well as post 2023.

azesmway commented 3 months ago

Added support for Unity 2023 and higher