From ea3400d2083d93b2e9fedcf618a2c21bc7747ca7 Mon Sep 17 00:00:00 2001 From: Kushal Shukla <75110041+AlwaysKushal@users.noreply.github.com> Date: Thu, 23 Oct 2025 13:20:42 +0530 Subject: [PATCH] docs: add optional Unity 6 fix in Android section to handle FrameLayout error in UPlayer.java Added optional instructions for Unity 6 users to fix FrameLayout errors in UPlayer.java on Android integration. Tested and documented the fix on macOS (M4 Mac Mini). This update helps Unity 6 users avoid runtime crashes related to requestFrame(). --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b747d4..3e0800f 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,21 @@ If you're using expo, you're done. The built-in expo plugin will handle the rest ```javascript Game view ``` - +5. Optional (Unity 6 Only) to `node_modules/@azesmway/react-native-unity/android/src/main/java//UPlayer.java` + + ***Inside the UPlayer class, find the method named requestFrame() and replace its contents with the following implementation:*** +```Java +public FrameLayout requestFrame() throws NoSuchMethodException { + try { + Method getFrameLayout = unityPlayer.getClass().getMethod("getFrameLayout"); + return (FrameLayout) getFrameLayout.invoke(unityPlayer); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + // For Unity 6 compatibility, replace unityPlayer reference with null + return null; + } +} +``` + # Known issues - Does not work on the iOS simulator.