@dolami-inc/react-native-expo-unity 0.1.5 → 0.1.6
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 +10 -10
- package/ios/ExpoUnity.podspec +21 -14
- package/package.json +1 -1
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
|
|
@@ -97,7 +97,7 @@ cp <unity-build>/{baselib.a,il2cpp.a,libGameAssembly.a} unity/builds/ios/
|
|
|
97
97
|
{
|
|
98
98
|
"expo": {
|
|
99
99
|
"plugins": [
|
|
100
|
-
"react-native-expo-unity"
|
|
100
|
+
"@dolami-inc/react-native-expo-unity"
|
|
101
101
|
]
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -111,7 +111,7 @@ The plugin automatically configures the required Xcode build settings:
|
|
|
111
111
|
If your Unity artifacts are in a custom path, pass the option:
|
|
112
112
|
|
|
113
113
|
```json
|
|
114
|
-
["react-native-expo-unity", { "unityPath": "/absolute/path/to/unity/builds/ios" }]
|
|
114
|
+
["@dolami-inc/react-native-expo-unity", { "unityPath": "/absolute/path/to/unity/builds/ios" }]
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
### 5. Build
|
package/ios/ExpoUnity.podspec
CHANGED
|
@@ -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,33 @@ 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
27
|
|
|
29
|
-
#
|
|
30
|
-
# We avoid
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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'))
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
unity_ldflags = []
|
|
38
|
+
unity_ldflags << '-framework UnityFramework' if framework_exists
|
|
39
|
+
unity_ldflags += a_files.map { |f| "\"#{f}\"" }
|
|
38
40
|
|
|
39
41
|
s.pod_target_xcconfig = {
|
|
40
|
-
'HEADER_SEARCH_PATHS'
|
|
41
|
-
'
|
|
42
|
+
'HEADER_SEARCH_PATHS' => "\"#{unity_ios_dir}/UnityFramework.framework/Headers\"",
|
|
43
|
+
'FRAMEWORK_SEARCH_PATHS' => "\"#{unity_ios_dir}\"",
|
|
44
|
+
'OTHER_LDFLAGS' => unity_ldflags.join(' '),
|
|
45
|
+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
42
46
|
'GCC_PREPROCESSOR_DEFINITIONS' => 'UNITY_FRAMEWORK=1',
|
|
43
|
-
'ENABLE_BITCODE'
|
|
47
|
+
'ENABLE_BITCODE' => 'NO'
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
s.user_target_xcconfig = {
|
|
47
|
-
'ENABLE_BITCODE'
|
|
51
|
+
'ENABLE_BITCODE' => 'NO',
|
|
52
|
+
'FRAMEWORK_SEARCH_PATHS' => "\"#{unity_ios_dir}\"",
|
|
53
|
+
'LIBRARY_SEARCH_PATHS' => "\"#{unity_ios_dir}\"",
|
|
54
|
+
'OTHER_LDFLAGS' => unity_ldflags.join(' ')
|
|
48
55
|
}
|
|
49
56
|
end
|