flutter-unity-view-widget
flutter-unity-view-widget copied to clipboard
Unity Web is not showing, no errors thrown
Describe the bug UnityWidget Web is not showing on Web Page
To Reproduce Steps to reproduce the behavior:
- Create a UnityWidget widget
- set webUrl to "http://localhost:6080/"
- Run on browser
Expected behavior Unity Scene showing up
Unity (please complete the following information):
- Unity Version 2022.1.0b16.3019
Platforms (please complete the following information):
- Edge
- Chrome
Additional context The scene loads because the onUnityCreated is called, but onUnityMessage / onSceneLoaded are not called. There is no error on the console, here's the output:
crbug/1173575, non-JS module files deprecated.
Flutter Web Bootstrap: Auto
Height of Platform View type: [_iframe_99df850e_a9d7_4cce_816b_a98a067cfa7c] may not be set. Defaulting to height: 100%.
Set style.height to any appropriate value to stop this message.
Width of Platform View type: [_iframe_99df850e_a9d7_4cce_816b_a98a067cfa7c] may not be set. Defaulting to width: 100%.
Set style.width to any appropriate value to stop this message.
[log] Loaded
[log] *********************************************
[log] ** flutter unity controller setup complete **
[log] *********************************************
crbug/1173575, non-JS module files deprecated.
here's the code:
Widget build(BuildContext context) { return Container( width: 300, height: 300, color: Colors.amber, child: UnityWidget( onUnityCreated: onUnityCreated, onUnityMessage: onUnityMessage, onUnitySceneLoaded: onSceneLoaded, fullscreen: false, useAndroidViewSurface: false, webUrl: 'http://localhost:6080/', ), ); }
Seeing this same issue and having a lot of trouble finding information in general on running in a web context. It would be great to see an example along with some set up instructions for web.
Follow and upvote these Fixes:
- https://github.com/juicycleff/flutter-unity-view-widget/pull/616
- https://github.com/juicycleff/flutter-unity-view-widget/pull/617
- https://github.com/juicycleff/flutter-unity-view-widget/pull/618
@Ahmadre thank you for your help, but i can't get the point. I started working on a blank project and imported this package and by following the readme i set up everything. I don't have any WebUnityWidgetController class, that is one of your fixes, what is happening?
@riccardocescon The web implementation was not fully completed, which is what is contained in these fixes. Once they are merged in, the web should be functional. I've updated my own local files with these changes, which seems to have worked. I'm hopeful that these can be merged soon. @Ahmadre What is the merge/release status of these?
I have added several fixes to web again in a new fuw-2022.1.1-v2.unitypackage, Please use that guys inside: unitypackages
@Ahmadre thank you for your help, but i can't get the point. I started working on a blank project and imported this package and by following the readme i set up everything. I don't have any WebUnityWidgetController class, that is one of your fixes, what is happening?
Oh and by the way: you don't need WebUnityWidgetController. This is just an internal class which is used for internal web control. You are using Unity Controller like always in every platform. That's what interface classes are made for :3
I also informed the package owner about a new release :3 Because I have only access to github and not pub.dev. Hopefully a new version with web stable will come soon :3
@riccardocescon please also consider using webUrl like this: https://github.com/juicycleff/flutter-unity-view-widget/blob/9bcaf83c2f6e49d67a5defc29cea967c80ca8932/example/lib/screens/simple_screen.dart#L49
it's important to not have a / at the end!
@Ahmadre Thank you for your help!
I tried first to use the new version: 2022.1.1+4 but the same thing happened.
Then i downloaded the fuw-2022.1.1-v2.unitypackage you gave. I deleted the old FlutterUnityIntegration and imported the new package as a library (excluding the Demo folder). I then tried toExport to Web GL but i got some errors during the build: TypeDB: Assembly index for 'path7to/project/Library/ScriptAssemblies/FlutterUnityIntegration.dll' was not found. UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) FlutterUnityIntegration.Editor.Build:BuildWebGL (string) (at Assets/Editor/Build.cs:123) FlutterUnityIntegration.Editor.Build:DoBuildWebGL () (at Assets/Editor/Build.cs:70)
Seems that file got deleted while importing the new package. Did i do something wrong?
@riccardocescon please also consider using webUrl like this:
https://github.com/juicycleff/flutter-unity-view-widget/blob/9bcaf83c2f6e49d67a5defc29cea967c80ca8932/example/lib/screens/simple_screen.dart#L49
it's important to not have a
/at the end!
When i tried to run the project with the new package i removed the / at the end but still it failed
https://user-images.githubusercontent.com/46368361/191577777-6721d5ef-933b-4021-af88-317156c777f9.mov
I have been trying to run this simple unity demo.. but it failed. showing in console "crbug/1173575, non-JS module files deprecated.". Please help me guys @Ahmadre @andybass