随笔记录2
来源:互联网 发布:win10办公软件下载 编辑:程序博客网 时间:2024/06/16 11:45
1. unity提供了AndroidJavaClass支持,直接贴源码:
if( nativeManager == null ){using( var jc = new AndroidJavaClass( "cn.easyar.android.NativeManager" ) ) nativeManager = jc.CallStatic<AndroidJavaObject>( "instance" );}string sdCardPath = nativeManager.Call<string>("GetExternalStoragePath");Debug.Log("SDCard Path : " + sdCardPath);if( sdCardPath != null && sdCardPath != "" ){// create SightPlus picture directory.if( !System.IO.Directory.Exists( System.IO.Path.Combine (sdCardPath, "Pictures") ) ){try{System.IO.Directory.CreateDirectory( System.IO.Path.Combine (sdCardPath, "Pictures") );}catch{Debug.Log("Create Pictures dir failed");}}if( !System.IO.Directory.Exists( System.IO.Path.Combine (sdCardPath, "Pictures/SightPlus") ) ){try{System.IO.Directory.CreateDirectory( System.IO.Path.Combine (sdCardPath, "Pictures/SightPlus") );}catch{Debug.Log("Create Pictures dir failed");}}if( System.IO.Directory.Exists( System.IO.Path.Combine (sdCardPath, "Pictures/SightPlus") ) ){screenshotRootPathForAndroid = System.IO.Path.Combine (sdCardPath, "Pictures/SightPlus");}}
2. UnityEngine下面的structure可以在子线程中调用,如Vector3, Color,说白了就是不继承UnityEngine.Object的对象。
3. 协程与多线程毫无关系,是多帧执行代码的方式,其他引擎也有类似的框架。原本一帧内完成的繁重工作 放到多帧里去执行,避免了卡帧的情况。贴个使用技巧:
<span style="white-space:pre"></span>float lastBreakTime = Time.time;for (int px=0; px<rpixels.Length; px++) {rpixels [px] = source.GetPixelBilinear (incX * ((float)px % targetWidth), flip ? 1 - incY * ((float)Mathf.Floor (px / targetWidth)<span style="white-space:pre"></span>) : incY * ((float)Mathf.Floor (px / targetWidth)));if (Time.time - lastBreakTime > 0.03f) {lastBreakTime = Time.time;yield return 0;}}
0 0
- 【OpenCV】随笔记录2
- 随笔记录2
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录.....
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 随笔记录
- 记录随笔
- JMS之activeMQ--点对点通信
- 使用openCV求两幅图像加和
- cocos2dx richText
- 小米智能插座采用Marvell EZ-Connect芯片解决方案--88MC200微控制器、Avastar 88W8801
- Swiper开启循环模式页面button失效
- 随笔记录2
- OC基础知识
- 设置textview字体颜色的几种方法
- maven in action(五)maven继承和聚合
- Redis、Memcached、Guava、Ehcache中的算法
- 解决谷歌浏览器“没有注册类”的方法
- 关于面试
- Python Intro - Numpy function vectorize
- 黑马程序员_JAVA反射机制(一)