Comments (10)
Android和Unity都不允许在非主线程操作UI吧
from uiwidgets.
Android和Unity都不允许在非主线程操作UI吧
在回调中写应该没问题吧?那应该怎么改呢?
from uiwidgets.
嗯嗯 首先你要打开debug模式, 然后会有相应的提示信息给到你.
Define UIWidgets_DEBUG
It's recommended to define the UIWidgets_DEBUG script symbol in editor, this will turn on debug assertion in UIWidgets, which will help to find potential bugs earlier. To do this: please go to Player Settings -> Other Settings -> Configuration -> Scripting Define Symbols, and add UIWidgets_DEBUG.
The symbol is for debug purpose, please remove it from your release build.
from uiwidgets.
嗯嗯 首先你要打开debug模式, 然后会有相应的提示信息给到你.
Define UIWidgets_DEBUG
It's recommended to define the UIWidgets_DEBUG script symbol in editor, this will turn on debug assertion in UIWidgets, which will help to find potential bugs earlier. To do this: please go to Player Settings -> Other Settings -> Configuration -> Scripting Define Symbols, and add UIWidgets_DEBUG.
The symbol is for debug purpose, please remove it from your release build.
你好,上面的报错就是加了 UIWidgets_DEBUG 后的报错信息,想问问有没有网络请求的 sample 供参考呢?
from uiwidgets.
Try to use "using (WindowProvider.of(BuildContext).getScope()) { ... }" to wrap your code.
BuildContext 如果在widget里面就是this.context.
from uiwidgets.
Android和Unity都不允许在非主线程操作UI吧
在回调中写应该没问题吧?那应该怎么改呢?
你的回调方法是在主线程里面声明的,但是它的调用是在异步线程中调用的,所以他还是在异步中执行的。应该在主线程中写一个调用队列,异步完成时把回调塞到队列里,然后主线程一直检测队列中是否有要执行的回调,如果有,就执行,这样UI操作就回到主线程执行了。
from uiwidgets.
Try to use "using (WindowProvider.of(BuildContext).getScope()) { ... }" to wrap your code.
BuildContext 如果在widget里面就是this.context.
Solved!
Thanks for your quick response, May I ask if there has a communication group for testing UIWidgets?
from uiwidgets.
https://connect.unity.com/u/kevin-gu
Add me as a friend and I will add you to our wechat group.
from uiwidgets.
@Latias94 using (WindowProvider.of(BuildContext).getScope()) { ... }
你是用这个方案解决的吗?
from uiwidgets.
@Latias94 using (WindowProvider.of(BuildContext).getScope()) { ... }
你是用这个方案解决的吗?
你好,我忘了... 不过你可以参考下两个官方开源应用的做法:
https://github.com/UnityTech/ConnectAppCN
https://github.com/UnityTech/DocCN
from uiwidgets.
Related Issues (20)
- uiwidgets和UGUI共存时,UGUI输入框输入会延迟 HOT 1
- Performance in Vulkan HOT 3
- Debug ERROR HOT 1
- 能否提供一个和原生unity sceen切换的示例?
- get_timeSinceStartup can only be called from the main thread HOT 3
- How to use UGUI in UIWidget HOT 1
- ---
- 没有showTimePicker
- 如何实现Image. alphahittestminimumthreshold?
- 包管理器导入UIwidgets方法(不是问题,只是记录一下方便其他人) HOT 1
- GestureDetector onTap doesn't work on webgl(Windows)
- Is it possible to add another package of pub.dev to use it? HOT 4
- Framerate drops 50% when having this in a panel in a scene. HOT 3
- 参照入门指南添加Click Me 点击没反应没报错,buildandrun到安卓手机直接平铺了如图,editor版本:2019.4.8f HOT 4
- Is this project going to have continued support from unity? HOT 3
- 提交bug
- 输入文本框的内容和光标之间对齐有问题。 HOT 2
- 使用UIWidgets开发游戏UI的性能问题 HOT 3
- Inconsistent Stack widget performance
- How to change widget state using setState from inside a Timer callback (如何从Timer回调内部使用setState更改小部件状态)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uiwidgets.