using UnityEngine; using System.Collections; using System.Windows.Forms; public class screenshots : MonoBehaviour { public int I = 1; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetKe
最近在做一个模型展示的项目,我的想法是根据滑动屏幕的x方向差值和Y方向的差值,来根据世界坐标下的X轴和Y轴进行旋转,但是实习时候总是有一些卡顿.在观察unity编辑器下的旋转之后,发现编辑器下的旋转非常流畅.仔细观察之后发现unity编辑器下的旋转运算模式如下图所示,红色箭头方向为触控滑动方向,黑色箭头为模型旋转的轴. 了解原理之后就是实现相关功能,具体实现还是粘代码吧.代码如下 using System.Collections; using System.Collections.Generic
在unity中写编辑器扩展工具,如在编辑器中加个菜单,点击这个菜单项时执行打包功能. 类如下,其中的静态变量,如果每次进来不清空,则LIST会越来越大,打包函数执行完后系统不会帮我们清空 #if UNITY_EDITOR using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEngine; using LitJ
先上代码: 1 using System.Threading; using UnityEngine; using System.IO; using System.Collections; public class TextureUtility { public class ThreadData { public int start; public int end; public ThreadData (int s, int e) { start = s; end = e; } } private
要做一个截图的功能,并且玩家可以在相册中看到. 做的时候遇到了三个问题: 1.unity自带的截图API,Application.CaptureScreenshot在Android上不生效 2.图片保存的路径获取 3.保存的图片可以在手机的文件管理中找到,但是相册中没有. 解决方案: 1.这个问题查了半天没有说原因,大多数人都给出了新方案用 File.WriteAllBytes去实现,代码如下: using UnityEngine; using System.Collections; using