-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
Today I used patch-package to patch @azesmway/react-native-unity@1.0.11 for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/@azesmway/react-native-unity/ios/RNUnityView.mm b/node_modules/@azesmway/react-native-unity/ios/RNUnityView.mm
index a4caa74..46e1a38 100644
--- a/node_modules/@azesmway/react-native-unity/ios/RNUnityView.mm
+++ b/node_modules/@azesmway/react-native-unity/ios/RNUnityView.mm
@@ -84,9 +84,14 @@ static RNUnityView *sharedInstance;
- (void)layoutSubviews {
[super layoutSubviews];
+ if(![self unityIsInitialized]) {
+ [self initUnityModule];
+ }
+
if([self unityIsInitialized]) {
self.ufw.appController.rootView.frame = self.bounds;
[self addSubview:self.ufw.appController.rootView];
+ [[self ufw] pause:false];
}
}
@@ -158,14 +163,12 @@ static RNUnityView *sharedInstance;
[super prepareForRecycle];
if ([self unityIsInitialized]) {
- [[self ufw] unloadApplication];
-
+ [[self ufw] pause:true];
+ // Keep Unity running when the view is recycled; just detach the view tree.
NSArray *viewsToRemove = self.subviews;
for (UIView *v in viewsToRemove) {
[v removeFromSuperview];
}
-
- [self setUfw:nil];
}
}
I believe the issues were likely caused by the new fabric architecture. When I upgraded the Expo SDK 49 -> 53 I started having these issues.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels