android 4.3.x 以上版本,不知道修改了哪里,按power键返回时,会导致游戏分辨率调整。
网上大多数做法是在onConfigurationChanged重新设置游戏的分辨率,这样会在切回来时,游戏可以调整为正确的分辨率。
mUnityPlayer.getView().getLayoutParams().width=mUnityPlayer._displayWidth;
mUnityPlayer.getView().getLayoutParams().height=mUnityPlayer._displayHeight;
这种做法基本上算是解决了问题。
实际上更好的方式是按power button后直接返回至游戏。发现unity的debug版本可以实现这个功能,有时间需要反编译下,看看代码差异在哪里。
0 条评论。