@dolami-inc/react-native-expo-unity 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # react-native-expo-unity
1
+ # @dolami-inc/react-native-expo-unity
2
2
 
3
3
  Unity as a Library (UaaL) bridge for React Native / Expo.
4
4
 
@@ -7,17 +7,17 @@ Unity as a Library (UaaL) bridge for React Native / Expo.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install react-native-expo-unity
10
+ npm install @dolami-inc/react-native-expo-unity
11
11
  # or
12
- yarn add react-native-expo-unity
12
+ yarn add @dolami-inc/react-native-expo-unity
13
13
  # or
14
- bun add react-native-expo-unity
14
+ bun add @dolami-inc/react-native-expo-unity
15
15
  ```
16
16
 
17
17
  ## Quick Start
18
18
 
19
19
  ```tsx
20
- import { UnityView, type UnityViewRef } from "react-native-expo-unity";
20
+ import { UnityView, type UnityViewRef } from "@dolami-inc/react-native-expo-unity";
21
21
 
22
22
  const unityRef = useRef<UnityViewRef>(null);
23
23
 
@@ -56,7 +56,7 @@ unityRef.current?.unloadUnity()
56
56
  Same as ref methods, callable anywhere (operates on the singleton):
57
57
 
58
58
  ```tsx
59
- import { postMessage, pauseUnity, resumeUnity, unloadUnity, isInitialized } from "react-native-expo-unity";
59
+ import { postMessage, pauseUnity, resumeUnity, unloadUnity, isInitialized } from "@dolami-inc/react-native-expo-unity";
60
60
  ```
61
61
 
62
62
  ## Setup
@@ -67,8 +67,8 @@ Copy the plugin files into your Unity project:
67
67
 
68
68
  ```bash
69
69
  # From node_modules after install
70
- cp node_modules/react-native-expo-unity/plugin/NativeCallProxy.h <UnityProject>/Assets/Plugins/iOS/
71
- cp node_modules/react-native-expo-unity/plugin/NativeCallProxy.mm <UnityProject>/Assets/Plugins/iOS/
70
+ cp node_modules/@dolami-inc/react-native-expo-unity/plugin/NativeCallProxy.h <UnityProject>/Assets/Plugins/iOS/
71
+ cp node_modules/@dolami-inc/react-native-expo-unity/plugin/NativeCallProxy.mm <UnityProject>/Assets/Plugins/iOS/
72
72
  ```
73
73
 
74
74
  ### 2. Unity project — build iOS
@@ -81,15 +81,17 @@ cp node_modules/react-native-expo-unity/plugin/NativeCallProxy.mm <UnityProject>
81
81
 
82
82
  ### 3. Copy build artifacts to your RN project
83
83
 
84
- Create `unity/builds/ios/` in your project root and copy:
84
+ Create `unity/builds/ios/` in your project root and copy all artifacts from your Unity iOS build:
85
85
 
86
86
  ```bash
87
87
  mkdir -p unity/builds/ios
88
88
  cp -R <unity-build>/UnityFramework.framework unity/builds/ios/
89
- cp <unity-build>/{baselib.a,il2cpp.a,libGameAssembly.a} unity/builds/ios/
89
+ cp <unity-build>/*.a unity/builds/ios/
90
90
  ```
91
91
 
92
- > Custom path? Set `EXPO_UNITY_PATH` environment variable to your Unity build directory.
92
+ The podspec references these files **directly by path** nothing is copied or embedded into the npm package. Updating your Unity build is as simple as replacing the contents of `unity/builds/ios/` and re-running `pod install`.
93
+
94
+ > Custom path? Set `EXPO_UNITY_PATH` environment variable pointing to your Unity build directory, or pass `unityPath` to the config plugin (see step 4).
93
95
 
94
96
  ### 4. Add the config plugin to `app.json`
95
97
 
@@ -97,7 +99,7 @@ cp <unity-build>/{baselib.a,il2cpp.a,libGameAssembly.a} unity/builds/ios/
97
99
  {
98
100
  "expo": {
99
101
  "plugins": [
100
- "react-native-expo-unity"
102
+ "@dolami-inc/react-native-expo-unity"
101
103
  ]
102
104
  }
103
105
  }
@@ -111,7 +113,7 @@ The plugin automatically configures the required Xcode build settings:
111
113
  If your Unity artifacts are in a custom path, pass the option:
112
114
 
113
115
  ```json
114
- ["react-native-expo-unity", { "unityPath": "/absolute/path/to/unity/builds/ios" }]
116
+ ["@dolami-inc/react-native-expo-unity", { "unityPath": "/absolute/path/to/unity/builds/ios" }]
115
117
  ```
116
118
 
117
119
  ### 5. Build
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
13
13
  s.name = 'ExpoUnity'
14
14
  s.version = package['version']
15
15
  s.summary = package['description']
16
- s.description = package['description']
16
+ s.description = package['description'] + '.'
17
17
  s.license = package['license']
18
18
  s.author = package['author']
19
19
  s.homepage = package['homepage']
@@ -24,26 +24,36 @@ Pod::Spec.new do |s|
24
24
  s.dependency 'ExpoModulesCore'
25
25
 
26
26
  s.source_files = '**/*.{h,m,mm,swift}'
27
- s.exclude_files = 'UnityFramework.framework/**/*'
28
-
29
- # Reference Unity build artifacts directly by absolute path.
30
- # We avoid copying because the pod source may be in a read-only package manager
31
- # cache (e.g. bun's node_modules/.bun/), which would cause silent copy failures.
32
- if File.exist?(File.join(unity_ios_dir, 'UnityFramework.framework'))
33
- s.vendored_frameworks = File.join(unity_ios_dir, 'UnityFramework.framework')
34
- end
35
-
36
- a_files = Dir.glob(File.join(unity_ios_dir, '*.a'))
37
- s.vendored_libraries = a_files unless a_files.empty?
38
27
 
28
+ # Unity build artifacts are referenced via xcconfig values using their absolute path.
29
+ # We intentionally avoid vendored_frameworks / vendored_libraries because:
30
+ # 1. CocoaPods requires those to be relative paths inside the pod source.
31
+ # 2. The pod source may live in a read-only package manager cache (e.g. bun),
32
+ # making file copies impossible.
33
+ # xcconfig values accept absolute paths and are passed through to Xcode as-is.
34
+ framework_exists = File.exist?(File.join(unity_ios_dir, 'UnityFramework.framework'))
35
+ a_files = Dir.glob(File.join(unity_ios_dir, '*.a'))
36
+
37
+ unity_ldflags = []
38
+ unity_ldflags << '-framework UnityFramework' if framework_exists
39
+ unity_ldflags += a_files.map { |f| "\"#{f}\"" }
40
+
41
+ # Unity framework is ARM-only (device build) — never link it for Simulator.
42
+ # The [sdk=iphoneos*] conditional ensures these settings only apply when
43
+ # building for a physical device, not the Simulator SDK.
39
44
  s.pod_target_xcconfig = {
40
- 'HEADER_SEARCH_PATHS' => "\"#{unity_ios_dir}/UnityFramework.framework/Headers\"",
41
- 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
42
- 'GCC_PREPROCESSOR_DEFINITIONS' => 'UNITY_FRAMEWORK=1',
43
- 'ENABLE_BITCODE' => 'NO'
45
+ 'HEADER_SEARCH_PATHS' => "\"#{unity_ios_dir}/UnityFramework.framework/Headers\"",
46
+ 'FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]' => "\"#{unity_ios_dir}\"",
47
+ 'OTHER_LDFLAGS[sdk=iphoneos*]' => unity_ldflags.join(' '),
48
+ 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
49
+ 'GCC_PREPROCESSOR_DEFINITIONS' => 'UNITY_FRAMEWORK=1',
50
+ 'ENABLE_BITCODE' => 'NO'
44
51
  }
45
52
 
46
53
  s.user_target_xcconfig = {
47
- 'ENABLE_BITCODE' => 'NO'
54
+ 'ENABLE_BITCODE' => 'NO',
55
+ 'FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]' => "\"#{unity_ios_dir}\"",
56
+ 'LIBRARY_SEARCH_PATHS[sdk=iphoneos*]' => "\"#{unity_ios_dir}\"",
57
+ 'OTHER_LDFLAGS[sdk=iphoneos*]' => unity_ldflags.join(' ')
48
58
  }
49
59
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolami-inc/react-native-expo-unity",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Unity as a Library (UaaL) bridge for React Native / Expo",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",