-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: refactored unity controller to a global singleton #733
base: master
Are you sure you want to change the base?
Conversation
…s outside a widget
…s outside a widget
…s outside a widget
[feat global_unity_controller] Update examples to null safety
I just did a check on android and here is my first impression, I will do more testing and try iOS later. It doesn't seem to be a breaking change for the existing example project, but the singleton needs some adjustments or documentation, as it doesn't always work as I would expect. The biggest issue is the last bullet point, crashing with unload. Using
|
WebGL is an interesting one. Unity doesn't stay active without a UnityWidget and boots from the splash screen for each UnityWidget. This makes the new streams kind of useless as we need to have a UnityWidget open anyway. The current api_screen.dart example is now broken on web as
I'm not sure it is worth the effort to implement the new method channels on web if they don't add new functionality. But it would be nice to fall back to the existing controller to avoid breaking things. |
Yeah it's only for mobile and nor for web. Web can still keep using unity widget controller |
This comment was marked as off-topic.
This comment was marked as off-topic.
@juicycleff 1White screen when returning to UnityWidget:
Now the no interaction demo page shows only white, instead of Unity. 2Might be the same issue, but I did not see this on the iPad, only on the Mac in “Designed for iPhone“ mode.
This only happens on Unity's first boot. Once you've got it visible it will keep working. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@timbotimbo sorry for being MIA for so long. Life happened, I will try to give the PR a lift and see where thing things lead. |
@juicycleff Welcome back. Can you look into publishing a plugin update before merging this? There have been quite a few bug fixes since 2022.2 and I think it is a good idea to have a 'safe' version before a major change like this. Some fixes have been merged in master, but there are a few open pull request that still need a look too. |
Hey @timbotimbo sure I'm currently looking at everything and will make a release as soon as I'm done probably tonight |
I have been thinking this would be nice to have so I can make it accessible with Provider. |
Description
Many times we want to control unity without having UnityWidget in the screen or during route transition load a unity scene. Both of these cases was impossible because the unity controller lives as long as the activie unitywidget is mounted.
This PR introduces a singleton flutter unity controller that lives outside the life span of the widget. That is you can control your unity instance from anywhere in your flutter code.
API spec
Listen to stream anywhere
Filter events by type to stream anywhere
Type of Change