{"_id":"@artmajeur/react-native-unity","_rev":"7-8edd7249a52eadb1767470f7c23faf93","name":"@artmajeur/react-native-unity","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.1":{"name":"@artmajeur/react-native-unity","version":"0.0.1","keywords":["react-native","ios","android","unity"],"author":{"url":"https://github.com/azesmway","name":"Alexey Zolotaryov","email":"azesm@me.com"},"license":"MIT","_id":"@artmajeur/react-native-unity@0.0.1","maintainers":[{"name":"maxnav","email":"maxime.navoizat@yourart.art"},{"name":"jindun.shao","email":"jindun.shao@yourart.art"},{"name":"pauletseya","email":"paul.etse@yourart.art"}],"homepage":"https://github.com/YourArtOfficial/react-native-unity#readme","bugs":{"url":"https://github.com/YourArtOfficial/react-native-unity/issues"},"dist":{"shasum":"e365885ce51df5cd3cf2310208be57d38e12a26c","tarball":"https://registry.npmjs.org/@artmajeur/react-native-unity/-/react-native-unity-0.0.1.tgz","fileCount":44,"integrity":"sha512-8LtlL7nKplC9yfwBqe2FE3FSuiWbgpu9F1ZhuRm0UoMU83v7d7bu+PfQxfSVvqRnTF3/0OkkYqx3RT2Qqwi2Cg==","signatures":[{"sig":"MEQCIFLmVQYV4ohWafXXpnDNPF3EBFA7I9n6GMn6aVuYKzi5AiBp3swaUAp7cF3OqqWEv2jpM4IU4rXUfpysLSBZ3amtvg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":74357},"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"main":"lib/commonjs/index","types":"lib/typescript/index.d.ts","module":"lib/module/index","source":"src/index","engines":{"node":">= 18.0.0"},"gitHead":"7bed75580a69acdaa9a7ce8ac49746fa2110332e","scripts":{"lint":"eslint \"**/*.{js,ts,tsx}\"","test":"jest","clean":"del-cli android/build example/android/build example/android/app/build example/ios/build lib","example":"yarn workspace react-native-unity-example","prepare":"npx react-native-builder-bob build","release":"release-it","typecheck":"tsc --noEmit"},"_npmUser":{"name":"jindun.shao","actor":{"name":"jindun.shao","type":"user","email":"jindun.shao@yourart.art"},"email":"jindun.shao@yourart.art"},"prettier":{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"},"commitlint":{"extends":["@commitlint/config-conventional"]},"release-it":{"git":{"tagName":"v${version}","commitMessage":"chore: release ${version}"},"npm":{"access":"public","publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":"angular"}}},"repository":{"url":"git+https://github.com/YourArtOfficial/react-native-unity.git","type":"git"},"workspaces":["example"],"_npmVersion":"11.4.2","description":"React Native Unity","directories":{},"resolutions":{"@types/react":"17.0.21"},"_nodeVersion":"24.3.0","eslintConfig":{"root":true,"rules":{"prettier/prettier":["error",{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"}]},"extends":["@react-native","prettier"]},"eslintIgnore":["node_modules/","lib/"],"react-native":"src/index","codegenConfig":{"name":"unityview","type":"components","jsSrcsDir":"src"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"packageManager":"yarn@3.6.1","devDependencies":{"jest":"^29.7.0","react":"18.2.0","turbo":"^1.10.7","eslint":"^8.4.1","del-cli":"^5.0.0","prettier":"^2.0.5","commitlint":"^17.0.2","release-it":"^15.0.0","typescript":"^5.0.2","@types/jest":"^28.1.2","pod-install":"^0.1.0","@types/react":"~17.0.21","react-native":"0.72.7","eslint-plugin-jest":"^28.5.0","@types/react-native":"0.70.0","expo-module-scripts":"^3.5.1","@expo/config-plugins":"^7.9.1","@evilmartians/lefthook":"^1.5.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","react-native-builder-bob":"^0.20.0","@react-native/eslint-config":"^0.72.2","@commitlint/config-conventional":"^17.0.2","@release-it/conventional-changelog":"^5.0.0"},"peerDependencies":{"react":"*","react-native":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-native-unity_0.0.1_1751543721148_0.14540636505419258","host":"s3://npm-registry-packages-npm-production"},"react-native-builder-bob":{"output":"lib","source":"src","targets":["commonjs","module",["typescript",{"project":"tsconfig.build.json"}]]}},"0.0.2":{"name":"@artmajeur/react-native-unity","version":"0.0.2","keywords":["react-native","ios","android","unity"],"author":{"url":"https://github.com/azesmway","name":"Alexey Zolotaryov","email":"azesm@me.com"},"license":"MIT","_id":"@artmajeur/react-native-unity@0.0.2","maintainers":[{"name":"maxnav","email":"maxime.navoizat@yourart.art"},{"name":"jindun.shao","email":"jindun.shao@yourart.art"},{"name":"pauletseya","email":"paul.etse@yourart.art"}],"homepage":"https://github.com/YourArtOfficial/react-native-unity#readme","bugs":{"url":"https://github.com/YourArtOfficial/react-native-unity/issues"},"dist":{"shasum":"292aa315a886e02ee9834aad41f667a9395af689","tarball":"https://registry.npmjs.org/@artmajeur/react-native-unity/-/react-native-unity-0.0.2.tgz","fileCount":43,"integrity":"sha512-Gi01kAKlrq+fnOgAStrbR8lgCATahZDjvZ4tgjjYPruR7efQbZFGFxLXpaUBpiq2XLmdIrZDSdf0kKy1D2i3gQ==","signatures":[{"sig":"MEYCIQDmjKRdxmmMH/m0VqD4Iga+TPWi3iIf9VkeUPOcRaJTywIhAL9YthQ526DWCyHTR3ODszBJEIILzt1wpIftCJ9DeDSE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77662},"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"main":"lib/commonjs/index","types":"lib/typescript/index.d.ts","module":"lib/module/index","source":"src/index","engines":{"node":">= 18.0.0"},"gitHead":"22fa31cd98fd04b3d43813fbeb371947aa566397","scripts":{"lint":"eslint \"**/*.{js,ts,tsx}\"","test":"jest","clean":"del-cli android/build example/android/build example/android/app/build example/ios/build lib","example":"yarn workspace react-native-unity-example","prepare":"npx react-native-builder-bob build","release":"release-it","typecheck":"tsc --noEmit"},"_npmUser":{"name":"jindun.shao","actor":{"name":"jindun.shao","type":"user","email":"jindun.shao@yourart.art"},"email":"jindun.shao@yourart.art"},"prettier":{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"},"commitlint":{"extends":["@commitlint/config-conventional"]},"release-it":{"git":{"tagName":"v${version}","commitMessage":"chore: release ${version}"},"npm":{"access":"public","publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":"angular"}}},"repository":{"url":"git+https://github.com/YourArtOfficial/react-native-unity.git","type":"git"},"workspaces":["example"],"_npmVersion":"11.4.2","description":"React Native Unity","directories":{},"resolutions":{"@types/react":"17.0.21"},"_nodeVersion":"24.3.0","eslintConfig":{"root":true,"rules":{"prettier/prettier":["error",{"useTabs":false,"tabWidth":2,"quoteProps":"consistent","singleQuote":true,"trailingComma":"es5"}]},"extends":["@react-native","prettier"]},"eslintIgnore":["node_modules/","lib/"],"react-native":"src/index","codegenConfig":{"name":"unityview","type":"components","jsSrcsDir":"src"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"packageManager":"yarn@3.6.1","devDependencies":{"jest":"^29.7.0","react":"18.2.0","turbo":"^1.10.7","eslint":"^8.4.1","del-cli":"^5.0.0","prettier":"^2.0.5","commitlint":"^17.0.2","release-it":"^15.0.0","typescript":"^5.0.2","@types/jest":"^28.1.2","pod-install":"^0.1.0","@types/react":"~17.0.21","react-native":"0.72.7","eslint-plugin-jest":"^28.5.0","@types/react-native":"0.70.0","expo-module-scripts":"^3.5.1","@expo/config-plugins":"^7.9.1","@evilmartians/lefthook":"^1.5.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","react-native-builder-bob":"^0.20.0","@react-native/eslint-config":"^0.72.2","@commitlint/config-conventional":"^17.0.2","@release-it/conventional-changelog":"^5.0.0"},"peerDependencies":{"react":"*","react-native":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-native-unity_0.0.2_1751552434771_0.16616908110998097","host":"s3://npm-registry-packages-npm-production"},"react-native-builder-bob":{"output":"lib","source":"src","targets":["commonjs","module",["typescript",{"project":"tsconfig.build.json"}]]}},"0.0.6":{"name":"@artmajeur/react-native-unity","version":"0.0.6","description":"React Native Unity","main":"lib/commonjs/index","module":"lib/module/index","types":"lib/typescript/index.d.ts","react-native":"src/index","source":"src/index","scripts":{"example":"yarn workspace react-native-unity-example","test":"jest","typecheck":"tsc --noEmit","lint":"eslint \"**/*.{js,ts,tsx}\"","clean":"del-cli android/build example/android/build example/android/app/build example/ios/build lib","prepare":"npx react-native-builder-bob build","release":"release-it"},"keywords":["react-native","ios","android","unity"],"repository":{"type":"git","url":"git+https://github.com/YourArtOfficial/react-native-unity.git"},"author":{"name":"Alexey Zolotaryov","email":"azesm@me.com","url":"https://github.com/azesmway"},"license":"MIT","bugs":{"url":"https://github.com/YourArtOfficial/react-native-unity/issues"},"homepage":"https://github.com/YourArtOfficial/react-native-unity#readme","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"devDependencies":{"@commitlint/config-conventional":"^17.0.2","@evilmartians/lefthook":"^1.5.0","@expo/config-plugins":"^7.9.1","@react-native/eslint-config":"^0.72.2","@release-it/conventional-changelog":"^5.0.0","@types/jest":"^28.1.2","@types/react":"~17.0.21","@types/react-native":"0.70.0","commitlint":"^17.0.2","del-cli":"^5.0.0","eslint":"^8.4.1","eslint-config-prettier":"^8.5.0","eslint-plugin-jest":"^28.5.0","eslint-plugin-prettier":"^4.0.0","expo-module-scripts":"^3.5.1","jest":"^29.7.0","pod-install":"^0.1.0","prettier":"^2.0.5","react":"18.2.0","react-native":"0.72.7","react-native-builder-bob":"^0.20.0","release-it":"^15.0.0","turbo":"^1.10.7","typescript":"^5.0.2"},"resolutions":{"@types/react":"17.0.21"},"peerDependencies":{"react":"*","react-native":"*"},"workspaces":["example"],"packageManager":"yarn@3.6.1","engines":{"node":">= 18.0.0"},"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"commitlint":{"extends":["@commitlint/config-conventional"]},"release-it":{"git":{"commitMessage":"chore: release ${version}","tagName":"v${version}"},"npm":{"publish":true,"access":"public"},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":"angular"}}},"eslintConfig":{"root":true,"extends":["@react-native","prettier"],"rules":{"prettier/prettier":["error",{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false}]}},"eslintIgnore":["node_modules/","lib/"],"prettier":{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false},"react-native-builder-bob":{"source":"src","output":"lib","targets":["commonjs","module",["typescript",{"project":"tsconfig.build.json"}]]},"codegenConfig":{"name":"unityview","type":"components","jsSrcsDir":"src"},"_id":"@artmajeur/react-native-unity@0.0.6","gitHead":"ef4cdafa28d8ebde01bc4dfb868283b5d04418c2","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-mn18SIjtsENiVJqMDq8lXQC4GhX2knu657VMcLlLtZbcN5jpmjJgyTpOJDwmt5dpc2z+hJEqi7e7J00vlPnIYQ==","shasum":"5bdb2886f8087c0eb05fb665ac0d8ab9f0bad39d","tarball":"https://registry.npmjs.org/@artmajeur/react-native-unity/-/react-native-unity-0.0.6.tgz","fileCount":43,"unpackedSize":77626,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDXxS3T3tHlUpTsQIeUbRsk06h3F2+PQhwrRjZj0BXupAiEA6RXOXpH4w7bAVh9MHf3eJYUyx/szqghel1myRJ1NoDQ="}]},"_npmUser":{"name":"jindun.shao","email":"jindun.shao@yourart.art"},"directories":{},"maintainers":[{"name":"maxnav","email":"maxime.navoizat@yourart.art"},{"name":"jindun.shao","email":"jindun.shao@yourart.art"},{"name":"pauletseya","email":"paul.etse@yourart.art"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native-unity_0.0.6_1753719994731_0.8239080513980879"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-03T11:55:21.040Z","modified":"2025-07-28T16:26:35.180Z","0.0.1":"2025-07-03T11:55:21.343Z","0.0.2":"2025-07-03T14:20:34.950Z","0.0.3":"2025-07-03T15:23:27.151Z","0.0.4":"2025-07-04T09:54:21.066Z","0.0.6":"2025-07-28T16:26:34.968Z"},"bugs":{"url":"https://github.com/YourArtOfficial/react-native-unity/issues"},"author":{"name":"Alexey Zolotaryov","email":"azesm@me.com","url":"https://github.com/azesmway"},"license":"MIT","homepage":"https://github.com/YourArtOfficial/react-native-unity#readme","keywords":["react-native","ios","android","unity"],"repository":{"type":"git","url":"git+https://github.com/YourArtOfficial/react-native-unity.git"},"description":"React Native Unity","maintainers":[{"name":"maxnav","email":"maxime.navoizat@yourart.art"},{"name":"jindun.shao","email":"jindun.shao@yourart.art"},{"name":"pauletseya","email":"paul.etse@yourart.art"}],"readme":"# @artmajeur/react-native-unity\n\nThe plugin that allows you to embed a Unity project into React Native as a full-fledged component. The plugin now supports the new architecture.\n\n### Android\n\nAttention! Added support for Unity 2023 and above\n\n> [!IMPORTANT]\n> For iOS, it is no longer necessary to embed a project created with Unity. Only the built `UnityFramework` is used. It should be placed in the plugin folder at the path - `<YOUR_RN_PROJECT>/unity/builds/ios`\n\n## Device Support:\n\n| Platform         | Supported |\n| ---------------- | --------- |\n| iOS Simulator    | ❌        |\n| iOS Device       | ✅        |\n| Android Emulator | ✅        |\n| Android Device   | ✅        |\n\n# Installation\n\n## Install this package in your react-native project:\n\n```sh\nnpm install @artmajeur/react-native-unity\n\nor\n\nyarn add @artmajeur/react-native-unity\n```\n\n## Configure your Unity project:\n\n1. Copy the contents of the folder `unity` to the root of your Unity project. This folder contains the necessary scripts and settings for the Unity project. You can find these files in your react-native project under `node_modules/@artmajeur/react-native-unity/unity`. This is necessary to ensure iOS has access to the `NativeCallProxy` class from this library.\n\n2. (optional) If you're following along with the example, you can add the following code to the `ButtonBehavior.cs` script in your Unity project. This allows the button press in Unity to communicate with your react-native app.\n\n<details>\n<summary>ButtonBehavior.cs</summary>\n\n```csharp\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\nusing UnityEngine.UI;\nusing UnityEngine;\n\npublic class NativeAPI {\n#if UNITY_IOS && !UNITY_EDITOR\n  [DllImport(\"__Internal\")]\n  public static extern void sendMessageToMobileApp(string message);\n#endif\n}\n\npublic class ButtonBehavior : MonoBehaviour\n{\n  public void ButtonPressed()\n  {\n    if (Application.platform == RuntimePlatform.Android)\n    {\n      using (AndroidJavaClass jc = new AndroidJavaClass(\"com.azesmwayreactnativeunity.ReactNativeUnityViewManager\"))\n      {\n        jc.CallStatic(\"sendMessageToMobileApp\", \"The button has been tapped!\");\n      }\n    }\n    else if (Application.platform == RuntimePlatform.IPhonePlayer)\n    {\n#if UNITY_IOS && !UNITY_EDITOR\n      NativeAPI.sendMessageToMobileApp(\"The button has been tapped!\");\n#endif\n    }\n  }\n}\n```\n\n</details>\n\n## Export iOS Unity Project:\n\nAfter you've moved the files from the `unity` folder to your Unity project, you can export the iOS unity project by following these steps:\n\n1. Open your Unity project\n2. Build Unity project for ios in ANY folder - just not the main RN project folder!!!\n3. Open the created project in XCode\n4. Select Data folder and set a checkbox in the \"Target Membership\" section to \"UnityFramework\" ![image info](./docs/step1.jpg)\n5. You need to select the NativeCallProxy.h inside the `Unity-iPhone/Libraries/Plugins/iOS` folder of the Unity-iPhone project and change UnityFramework’s target membership from Project to Public. Don’t forget this step! (if you don't see these files in your Xcode project, you didn't copy over the `unity` folder to your Unity project correctly in previous steps) ![image info](./docs/step2.jpg)\n6. If required - sign the project `UnityFramework.framework` and build a framework ![image info](./docs/step3.jpg)\n7. Open the folder with the built framework (by right-clicking) and move it to the plugin folder (`<YOUR_RN_PROJECT>/unity/builds/ios`) ![image info](./docs/step4.jpg)\n8. Remove your `Pods` cache and lockfile with this command in the root of the main RN project `rm -rf ios/Pods && rm -f ios/Podfile.lock && npx pod-install`\n\n### Android\n\n1. Open your Unity project\n2. Export Unity app to `<YOUR_RN_PROJECT>/unity/builds/android`\n3. Remove `<intent-filter>...</intent-filter>` from `<YOUR_RN_PROJECT>/unity/builds/android/unityLibrary/src/main/AndroidManifest.xml` at unityLibrary to leave only integrated version.\n\nIf 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.\n\n1. Add the following lines to `android/settings.gradle`:\n   ```groovy\n   include ':unityLibrary'\n   project(':unityLibrary').projectDir=new File('..\\\\unity\\\\builds\\\\android\\\\unityLibrary')\n   ```\n2. Add into `android/build.gradle`\n   ```groovy\n   allprojects {\n     repositories {\n       // this\n       flatDir {\n           dirs \"${project(':unityLibrary').projectDir}/libs\"\n       }\n       // ...\n     }\n   }\n   ```\n3. Add into `android/gradle.properties`\n   ```gradle\n   unityStreamingAssets=.unity3d\n   ```\n4. Add strings to `android/app/src/main/res/values/strings.xml`\n\n   ```javascript\n   <string name=\"game_view_content_description\">Game view</string>\n   ```\n\n# Known issues\n\n- Does not work on the iOS simulator.\n- On iOS the Unity view is waiting for a parent with dimensions greater than 0 (from RN side). Please take care of this because if it is not the case, your app will crash with the native message `MTLTextureDescriptor has width of zero`.\n\n# Usage\n\n## Sample code\n\n```jsx\nimport React, { useRef, useEffect } from 'react';\n\nimport UnityView from '@artmajeur/react-native-unity';\nimport { View } from 'react-native';\n\ninterface IMessage {\n  gameObject: string;\n  methodName: string;\n  message: string;\n}\n\nconst Unity = () => {\n  const unityRef = useRef<UnityView>(null);\n\n  useEffect(() => {\n    if (unityRef?.current) {\n      const message: IMessage = {\n        gameObject: 'gameObject',\n        methodName: 'methodName',\n        message: 'message',\n      };\n      unityRef.current.postMessage(\n        message.gameObject,\n        message.methodName,\n        message.message\n      );\n    }\n  }, []);\n\n  return (\n    <View style={{ flex: 1 }}>\n      <UnityView\n        ref={unityRef}\n        style={{ flex: 1 }}\n        onUnityMessage={(result) => {\n          console.log('onUnityMessage', result.nativeEvent.message);\n        }}\n      />\n    </View>\n  );\n};\n\nexport default Unity;\n```\n\n## Props\n\n- `style: ViewStyle` - styles the UnityView. (Won't show on Android without dimensions. Recommended to give it `flex: 1` as in the example)\n- `onUnityMessage?: (event: NativeSyntheticEvent)` - receives a message from a Unity\n- `androidKeepPlayerMounted?: boolean` - if set to true, keep the player mounted even when the view that contains it has lost focus. The player will be paused on blur and resumed on focus. **ANDROID ONLY**\n- `fullScreen?: boolean` - defaults to true. If set to false, will not request full screen access. **ANDROID ONLY**\n\n## Methods\n\n- `postMessage(gameObject, methodName, message)` - sends a message to the Unity. **FOR IOS:** The native method of unity is used to send a message\n  `sendMessageToGOWithName:(const char*)goName functionName:(const char*)name message:(const char*)msg;`, more details can be found in the [documentation](https://docs.unity3d.com/2021.1/Documentation/Manual/UnityasaLibrary-iOS.html)\n- `unloadUnity()` - the Unity is unloaded automatically when the react-native component is unmounted, but if you want to unload the Unity, you can call this method\n- `pauseUnity?: (pause: boolean)` - pause the Unity\n- `windowFocusChanged(hasFocus: boolean = false)` - simulate focus change (intended to be used to recover from black screen (not rendering) after remounting Unity view when `resumeUnity` does not work) **ANDROID ONLY**\n\n# Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n# License\n\nMIT\n","readmeFilename":"README.md"}