[Unity]最近遇到的几个问题.(不间断更新)
来源:互联网 发布:软件测试职位描述 编辑:程序博客网 时间:2024/06/05 08:55
- 隐藏虚拟键盘即NavigationSystem Bar
- 另外一种解决方案之前使用的这种
- Unsupported majorminor version 520
- Unity用dll加载慢
- 获取某个方法执行时间
1.隐藏虚拟键盘,即Navigation/System Bar.
原文:Hiding the navigation/system bar in Android
protected void onCreate(Bundle paramBundle){ requestWindowFeature(1); super.onCreate(paramBundle); getWindow().takeSurface(null); setTheme(16973831); getWindow().setFormat(4); this.mUnityPlayer = new UnityPlayer(this); if (this.mUnityPlayer.getSettings().getBoolean("hide_status_bar", true)) { getWindow().setFlags(1024, 1024); } setContentView(this.mUnityPlayer); this.mUnityPlayer.requestFocus();}
另外一种解决方案(之前使用的这种)
private int currentApiVersion;// 丢入OnCreate中用来隐藏虚拟按键private void HideNavigationBar(){ // This work only for android 4.4+ if (currentApiVersion >= Build.VERSION_CODES.KITKAT) { currentApiVersion = android.os.Build.VERSION.SDK_INT; final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; getWindow().getDecorView().setSystemUiVisibility(flags); // Code below is to handle presses of Volume up or Volume down. // Without this, after pressing volume buttons, the navigation bar // will // show up and won't hide final View decorView = getWindow().getDecorView(); decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { decorView.setSystemUiVisibility(flags); } } }); }}// @SuppressLint("NewApi")// @Overridepublic void onWindowFocusChanged(boolean hasFocus){ super.onWindowFocusChanged(hasFocus); if(currentApiVersion >= Build.VERSION_CODES.KITKAT && hasFocus) { getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); }}
2. Unsupported major.minor version 52.0.
出现这个问题的原因貌似是因为我更新了一下AndroidStudio….然后jdk出现了错误.
根据Google以及百度的答案是因为Jdk不匹配,所以解决方案是更新Jdk.
3.Unity用dll加载慢.
在dll的属性中加上
[assembly: UnityEngine.UnityAPICompatibilityVersion(“5.4.0f3”)]
4.获取某个方法执行时间.
using UnityEngine;using System.Collections;using System.Diagnostics;public class NewBehaviourScript : MonoBehaviour { void Start () { float t = Time.time; TestMethod(); UnityEngine.Debug.Log(string.Format("total: {0} ms",Time.time - t)); Stopwatch sw = new Stopwatch(); sw.Start(); TestMethod(); sw.Stop(); UnityEngine.Debug.Log(string.Format("total: {0} ms",sw.ElapsedMilliseconds)); Profiler.BeginSample("TestMethod"); TestMethod(); Profiler.EndSample(); } void TestMethod() { for(int i =0; i < 10000000; i++) { } }}
0 0
- [Unity]最近遇到的几个问题.(不间断更新)
- 最近遇到的几个问题
- 最近遇到的几个问题
- 最近遇到的几个问题
- 最近面试遇到的几个问题
- 最近使用Eclipse遇到的几个问题
- 最近使用Eclipse遇到的几个问题
- 记录平时遇到的一些问题,不间断更新
- 2016.4.11 最近看书遇到的几个问题的总结
- 最近解决的几个问题
- 试题遇到的几个问题
- Pytorch遇到的几个问题
- 最近调FPGA的几个问题
- 关于IE8的坑 (不间断更新)
- 总结最近SVN更新时遇到的"<<<<<<< .mine“,>>>>>.的问题
- 开发中遇到的几个问题
- VC2005/2008 遇到的几个问题
- Web中遇到的几个问题
- 用redis轻松实现秒杀系统
- Linux中断子系统 - softirq
- Gradle 完整指南(Android)
- SQL 左外连接,右外连接,全连接,内连接
- 决定换博客了
- [Unity]最近遇到的几个问题.(不间断更新)
- Two Sum
- ORACLE EXPLAIN PLAN的总结 (优化SQL语句)
- BeanUtils
- OpenCV ROI区域图像叠加&初级图像混合
- 【Spring学习笔记】ApplicationContext Vs WebApplicationContext
- 当下最流行的点击效果插件 waves.js
- CUDA 编程实例:计算点云法线
- 3.7.1计算电费