-
Notifications
You must be signed in to change notification settings - Fork 530
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
There's no way to release Unity resources #281
Comments
Same here. Every time I use UnityWidget a new instance was created and if I change scene in one of it onUnitySceneLoaded is called as many times it was loaded in each one of them. |
I believe I am experiencing the same issue on iOS. For me, whenever another instance is created, Flutter stops receiving messages from Unity, whereas messages are being sent correctly to Unity. And, when enough instances are opened, Unity freezes. |
any solutions. Facing the same issue |
This is exactly what I am experiencing in iOS. Is there any explanation for this that could lead to a potential solution? @juicycleff @thomas-stockx @jaboyc |
@OGmetamonkey please use v4 branch, mind you it's still in alpha. Will make an alpha release officially this week |
Tried it out. I keep getting Rebuilt it three times while implementing every step to try and find the problem. No dice. |
Output:
Encountered error while building for device. |
Hi @juicycleff , I just tried the latest commit of V4. I still get these errors when trying to compile for iPhone:
I noticed there is a typo in step 3 and 4 of the iOS setup (shown below). Did you intend to remove step 3?
|
@OGmetamonkey Please look at the readme in v4 branch. You need to remove unityutils.h |
@juicycleff I'm having trouble understanding that. Am I looking at the right thing? |
@OGmetamonkey I just updated the readme |
@juicycleff So that actually allowed the app to build on VS Code, but still not on XCode, and when running in VSCode it's crashing when Unity is launched. 'exited sigterm' So I tried to run 'flutter build ios' and I get the following errors:
|
@Zazo032 sorry for the late reply, but you navigating away from unity widget screen does not remove unity resources, you should read up the unity as a library documentation. This has nothing to do with the flutter package. However, you can improve this by navigating to an empty unity scene, before leaving your current unity widget |
But there's no native way to "dispose" the Unity controller that is being used to be able to free resources? |
My log when I get the crash:
|
Did you properly import UnityFramework.framework just as the docs |
I did. Tried multiple times just to be sure.
On Wed, Feb 10, 2021 at 11:54 AM Rex Raphael ***@***.***> wrote:
@juicycleff <https://github.com/juicycleff> So that actually allowed the
app to build on VS Code, but still not on XCode, and when running in VSCode
it's crashing when Unity is launched. 'exited sigterm'
So I tried to run 'flutter build ios' and I get the following errors:
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Command CompileSwift failed with a nonzero exit code
Development/project/flutter-unity-view-widget-4/ios/Classes/FLTUnityView.swift:10:8:
error:
no such module 'UnityFramework'
import UnityFramework
^
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.
*My log when I get the crash:*
flutter: Unity is created!!with unityId: 0
flutter: *********************************************
flutter: ** flutter unity controller setup complete **
flutter: *********************************************
Lost connection to device.
Did you properly import UnityFramework.framework just as the docs
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#281 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD5IQJEQLABXKUT4UDWUNWDS6K23XANCNFSM4VA4NNBA>
.
--
|
@OGmetamonkey dies this issue exist in the example because it just might be cached references issue |
@juicycleff Sorry for delay. I both ran the fresh V4 example and tried to clean my own project. I ended up eliminating the previous problem in my project but getting 2 new errors. I got the same 2 errors in the example project. The errors below exist in both the example project and my current project:
Here is how I got my own project to that point:
Like I said, same errors in both the example and my project. So I imagine your suggestion that it was a cache issue is correct. These errors may be unrelated to this current issue, but it seems to be a problem. |
@OGmetamonkey oh this is simple, I was supposed to automate it. Will send you a quick fix a moment |
@OGmetamonkey Made a push. I just enabled it. You will have to download the unity script package again. That should fix it for you. And try using unity 2019.4.3 or later as it contains a lot of unity as a player fix from unity |
@juicycleff That worked!! With these changes, V4 fixes the messenger issue! Thanks so much! |
hello. and i got another error - |
Use the latest push on the V4 branch and do the following:
|
/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_unity_widget-4.0.0-alpha.2/ios/Classes/FLTUnityView.swift:10:8: No such module 'UnityFramework' the error is still there |
Try Unity 2020.2.3f1 |
after updating the version of the unity - those errors are gone, but other errors appeared after build in xCode Apple Mach-O Linker (ld) Error Group |
Not sure. First thing I always try is a flutter clean from terminal and a cmd-shift-k in xcode. |
@OGmetamonkey , your comments helped alot to resolve these errors. Thank you so much. I can able to resolve these errors in the Unity Editor : 2019.4.22 |
I'd like to know the answer to this too please @juicycleff |
Please use the version 2019.3.14 or later. But it also largely depends on how you use build you architect your game. Largely the unload function has never predictably work even after a conversation with the unity team behind UaaL |
I know what's the error eventually. Try this solution: https://github.com/Ahmadre/unity_widget#solutions-to-problems |
Describe the bug
There's no way to release resources used by
UnityWidget
. We are using Unity for an AR feature, and the second time you open the screen with aUnityWidget
, camera lags a lot and there's no loading screen, meaning previous Unity resources were not released. Moreover, doing it 2/3 times fast enough crashes the app because it runs out of memory.To Reproduce
In the example app, you can see a similar behavior:
Expected behavior
After disposing the controller, it should stop all Unity resources
Actual behavior
Disposing/unloading the controller doesn't help with resources, and calling
quit
closes the app.Smartphone (please complete the following information):
Additional context
Also tried using
openInNativeProcess
and adding the extended activity in manifest, but that way we can't communicate with messages to the Unity process.The text was updated successfully, but these errors were encountered: