UnityWidget 组件属性
fullscreen: 布尔值,是否全屏显示 UnityWidget 组件
UnityWidget 组件生命周期
//1
onUnityMessage(data):
触发时机:Unity 通过 SendMessageToFlutter 发布消息
//2
onUnitySceneLoaded(String name, int buildIndex, bool isLoaded, bool isValid):
触发时机:Unity 场景加载完成
//3
onUnityUnloaded():
触发时机:Unity 场景被销毁
UnityWidgetController API
pause(): 暂停 Unity 循环
resume(): 继续 Unity 循环
unload(): 销毁 Unity 场景
quit(): 退出 Unity 应用
postMessage(String gameObject, methodName, message): 调用 Unity 类方法
Unity API 文档
SendMessageToFlutter(string): 发布消息,Flutter 通过 onUnityMessage 订阅消息
参考:
https://www.jianshu.com/p/80d204950b51
https://pub.dev/packages/flutter_unity_widget
http://liweijia.site/archives/1405
https://www.youtube.com/watch?v=exNPmv_7--Q
https://ivanfan.site/2020/07/21/uiwidgets/
网友评论