Skip to content

Commit aa57034

Browse files
committed
prettier formatted readme
1 parent 6c75491 commit aa57034

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

README.md

+39-36
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
The plugin that allows you to embed a Unity project into React Native as a full-fledged component. The plugin now supports the new architecture.
44

5-
65
> [!IMPORTANT]
76
> 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`
87
98
## Device Support:
109

11-
| Platform | Supported |
12-
| -------- | --------- |
13-
| iOS Simulator ||
14-
| iOS Device ||
15-
| Android Emulator ||
16-
| Android Device ||
17-
10+
| Platform | Supported |
11+
| ---------------- | --------- |
12+
| iOS Simulator ||
13+
| iOS Device ||
14+
| Android Emulator ||
15+
| Android Device ||
1816

1917
# Installation
2018

@@ -72,6 +70,7 @@ public class ButtonBehavior : MonoBehaviour
7270
}
7371
}
7472
```
73+
7574
</details>
7675

7776
## Export iOS Unity Project:
@@ -91,7 +90,7 @@ After you've moved the files from the `unity` folder to your Unity project, you
9190

9291
1. Open your Unity project
9392
2. Export Unity app to `<YOUR_RN_PROJECT>/unity/builds/android`
94-
3. Remove `<intent-filter>...</intent-filter>` from ``<project_name>/unity/builds/android/unityLibrary/src/main/AndroidManifest.xml`` at unityLibrary to leave only integrated version.
93+
3. Remove `<intent-filter>...</intent-filter>` from `<YOUR_RN_PROJECT>/unity/builds/android/unityLibrary/src/main/AndroidManifest.xml` at unityLibrary to leave only integrated version.
9594

9695
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.
9796

@@ -101,26 +100,26 @@ If you're using expo, you're done. The built-in expo plugin will handle the rest
101100
project(':unityLibrary').projectDir=new File('..\\unity\\builds\\android\\unityLibrary')
102101
```
103102
2. Add into `android/build.gradle`
104-
```groovy
105-
allprojects {
106-
repositories {
107-
// this
108-
flatDir {
109-
dirs "${project(':unityLibrary').projectDir}/libs"
110-
}
111-
// ...
112-
}
113-
}
114-
```
103+
```groovy
104+
allprojects {
105+
repositories {
106+
// this
107+
flatDir {
108+
dirs "${project(':unityLibrary').projectDir}/libs"
109+
}
110+
// ...
111+
}
112+
}
113+
```
115114
3. Add into `android/gradle.properties`
116-
```gradle
117-
unityStreamingAssets=.unity3d
118-
```
119-
4. Add strings to ``android/app/src/main/res/values/strings.xml``
115+
```gradle
116+
unityStreamingAssets=.unity3d
117+
```
118+
4. Add strings to `android/app/src/main/res/values/strings.xml`
120119

121-
```javascript
122-
<string name="game_view_content_description">Game view</string>
123-
```
120+
```javascript
121+
<string name="game_view_content_description">Game view</string>
122+
```
124123

125124
# Known issues
126125

@@ -131,7 +130,7 @@ If you're using expo, you're done. The built-in expo plugin will handle the rest
131130

132131
## Sample code
133132

134-
```js
133+
```jsx
135134
import React, { useRef, useEffect } from 'react';
136135

137136
import UnityView from '@azesmway/react-native-unity';
@@ -153,7 +152,11 @@ const Unity = () => {
153152
methodName: 'methodName',
154153
message: 'message',
155154
};
156-
unityRef.current.postMessage(message.gameObject, message.methodName, message.message);
155+
unityRef.current.postMessage(
156+
message.gameObject,
157+
message.methodName,
158+
message.message
159+
);
157160
}
158161
}, []);
159162

@@ -163,7 +166,7 @@ const Unity = () => {
163166
ref={unityRef}
164167
style={{ flex: 1 }}
165168
onUnityMessage={(result) => {
166-
console.log('onUnityMessage', result.nativeEvent.message)
169+
console.log('onUnityMessage', result.nativeEvent.message);
167170
}}
168171
/>
169172
</View>
@@ -175,23 +178,23 @@ export default Unity;
175178
176179
## Props
177180
178-
- `style: ViewStyle` - styles the UnityView. (Won't show on Android without dimensions. Recommended to give it `flex: 1` as in the example)
181+
- `style: ViewStyle` - styles the UnityView. (Won't show on Android without dimensions. Recommended to give it `flex: 1` as in the example)
179182
- `onUnityMessage?: (event: NativeSyntheticEvent)` - receives a message from a Unity
180-
- `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**
181-
- `fullScreen?: boolean` - defaults to true. If set to false, will not request full screen access. **ANDROID ONLY**
183+
- `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**
184+
- `fullScreen?: boolean` - defaults to true. If set to false, will not request full screen access. **ANDROID ONLY**
182185
183186
## Methods
184187
185188
- `postMessage(gameObject, methodName, message)` - sends a message to the Unity. **FOR IOS:** The native method of unity is used to send a message
186-
`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)
189+
`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)
187190
- `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
188191
- `pauseUnity?: (pause: boolean)` - pause the Unity
189-
- `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**
192+
- `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**
190193
191194
# Contributing
192195
193196
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
194197
195198
# License
196199
197-
MIT
200+
MIT

0 commit comments

Comments
 (0)