Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewManagerResolver returns null for RNUnity or RCTRNUnityView #142

Open
Omaryehya21 opened this issue Dec 10, 2024 · 5 comments
Open

ViewManagerResolver returns null for RNUnity or RCTRNUnityView #142

Omaryehya21 opened this issue Dec 10, 2024 · 5 comments

Comments

@Omaryehya21
Copy link

Omaryehya21 commented Dec 10, 2024

Hello,

I'm trying to integrate a Unity project into my Expo app using the @azesmway/react-native-unity plugin. I followed the steps in the documentation and also referred to this article.

Steps Taken:

  1. Installed the package version @1.0.7.
  2. Created a basic stack with the following code in Unity.tsx in the tabs folder:
import React, { useRef } from 'react';
import UnityView from '@azesmway/react-native-unity';
import { View } from 'react-native';

const Unity = () => {
  const unityRef = useRef<UnityView>(null);

  return (
    <View style={{ flex: 1 }}>
      <UnityView
        ref={unityRef}
        style={{ flex: 1 }}
      />
    </View>
  );
};
export default Unity;
  1. Ran the app using Expo and tried to open the UnityView.

Error:
When attempting to render UnityView, I consistently get the following error:
ViewManagerResolver returns null for either RNUnity or RCTRNUnityView

What seems the problem I checked the dependency and the library is there.

@TruAmbition
Copy link
Collaborator

If you are using Xcode 16, please upgrade the package version 1.0.11. Please note, we don't officially support Expo. This package does support react-native projects without Export framework .

@Omaryehya21
Copy link
Author

Sorry for the late reply. I am currently using VSCode on Windows, and I even attempted to use Expo pre-build to access the Android Gradle and followed the steps in the README file, but the same issue persists. I initially assumed that Expo was supported, as the README mentions after the third step for running on Android: "Remove <intent-filter>...</intent-filter> from <YOUR_RN_PROJECT>/unity/builds/android/unityLibrary/src/main/AndroidManifest.xml at unityLibrary to leave only the integrated version." It further states, "If you're using Expo, you're done. The built-in Expo plugin will handle the rest. If you're not using Expo, you'll need to follow the steps below."

This left me a bit confused, as I am using the latest React Native/Expo package. Any clarification would be appreciated.

@EvvTim
Copy link

EvvTim commented Dec 16, 2024

Hello,

I am experiencing the same issue when trying to use Expo with the @azesmway/react-native-unity plugin. Specifically, I get the error:
ViewManagerResolver returns null for either RNUnity or RCTRNUnityView.

From my understanding, the documentation mentions that “if you’re using Expo, you’re done,” which implies that Expo should be supported. However, based on the clarification in this thread, Expo is not officially supported anymore.

I believe it might be helpful to update the documentation to explicitly state that Expo is not currently supported, or at least remove the references suggesting compatibility with Expo. This could save developers a lot of time and effort by avoiding confusion.

Thanks!

@Omaryehya21
Copy link
Author

Hello @EvvTim,
Have you resolved this issue? We’ve already built the front end using the latest Expo SDK (v52). I also tried using a pre-built Expo project and running it directly on Android (instead of through Expo Go), but the issue persists.

Have you discovered any workarounds for this?

@EvvTim
Copy link

EvvTim commented Dec 17, 2024

Hello @EvvTim, Have you resolved this issue? We’ve already built the front end using the latest Expo SDK (v52). I also tried using a pre-built Expo project and running it directly on Android (instead of through Expo Go), but the issue persists.

Have you discovered any workarounds for this?

You must run npx expo prebuild to generate native code for your project and then follow the step-by-step instructions from the README.

This worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants