Skip to content

Conversation

@amitpdev
Copy link

@amitpdev amitpdev commented Nov 7, 2025

Problem
When using React Native's new architecture (Fabric), Unity fails to initialize on iOS because updateProps is not reliably called during the initial component render cycle. This happens when:
No props are explicitly passed to the Unity view component
Props don't change between initial renders
The component uses only event handler props
This results in Unity never starting, showing "N/A" for SDK version, and games not loading on iOS devices.

Solution
Initialize Unity in layoutSubviews instead of relying solely on updateProps. The layoutSubviews method is always called by the iOS view system when a view is about to be displayed, making it a more reliable initialization point.
The check if(![self unityIsInitialized]) prevents double-initialization, ensuring this works correctly in both Fabric and the old architecture.

Testing
✅ Tested on real iOS devices (iPhone 15 Pro) with Fabric enabled
✅ Unity now initializes correctly and games load properly
✅ SDK version is correctly reported
✅ Backwards compatible with old architecture (Paper)

Related Issues
This addresses the root cause of Unity not initializing in Fabric mode, which may be affecting other developers using the new architecture but not yet reported.

In Fabric mode, updateProps may not be called during initial render.
Initialize Unity in layoutSubviews to ensure it starts when the view
is displayed, regardless of prop lifecycle. Backwards compatible.
@TackJordy
Copy link

Thank you so much!! Wasted so much time because of this issue

@jamie-currie
Copy link

Went from a blank screen to working straight away with this tweak thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants