
Unity3D
文章平均质量分 54
Hdfhj
这个作者很懒,什么都没留下…
展开
-
GPU 回调 截图
using Unity.Collections;using UnityEngine;using UnityEngine.Rendering;public sealed class AsyncCapture : MonoBehaviour{ (RenderTexture grab, RenderTexture flip) _rt; NativeArray<byte> _buffer; System.Collections.IEnumerator Start()...原创 2022-01-28 09:54:46 · 2994 阅读 · 0 评论 -
unity PlatformNotSupportedException: Operation is not supported on this platform
做项目开发的时候用到了Excel文件的读写,在编辑器里正常读取与写入,生成都没有问题,但发布exe后提示标题信息,经过一查才知道原来api改为 4.x就可以了,隐约记得好像用的就是4.x,谁给我改成2.0了,瞎耽误功夫......原创 2022-01-14 17:42:02 · 2406 阅读 · 1 评论 -
Unity Loom 脚本
using UnityEngine;using System.Collections;using System.Collections.Generic;using System;using System.Threading;using System.Linq;public class Loom : Singleton<Loom>{ //线程中无法自创建,所以需要使用此类时在start中先运行一下这个属性 public string getLoomVer {...原创 2022-01-03 11:24:05 · 1730 阅读 · 2 评论 -
Unity Json插件-SimpleJson|LitJson
public void ReadCanonConfig() { string str = FileManager.GetUidFromJson(ConstPath.canonConfig); var json = SimpleJSON.JSON.Parse(str); if (System.Convert.ToBoolean(json["auto"].AsInt)) { print(json["li...原创 2021-12-30 13:04:49 · 2756 阅读 · 0 评论 -
Unity 显示Fps 帧率
public Text fpsText; float time; int frameCount; // Update is called once per frame void Update() { time += Time.unscaledDeltaTime; frameCount++; if (time >= 1 && frameCount >= 1) { ...原创 2021-12-28 10:56:44 · 2030 阅读 · 0 评论 -
正则表达式
获取中括号中的内容:public static string GetBracketsValue(string content) { System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex(@"(?i)(?<=\[)(.*)(?=\])"); return rgx.Match(content).Value; }字符串多空格截取 ...原创 2021-12-28 07:59:43 · 170 阅读 · 0 评论 -
unity衣服模拟插件MagicaCloth
此插件的物理是独立于unity物理引擎的,两者互不影响,碰撞块是自己实现的,但暂时只支持三轴放缩,单轴放缩将来可能会支持,如果没有硬性需求也够用了,效果还是很不错的。主要使用到的是骨骼与布料模拟,骨骼可以使用在处理头发上,布料的应用就是衣服最常见的是处理裙子的摆动。内置的参数各种效果差不多都已有应用参数了,自己需要的效果在它原有的参数基础上稍稍修改还是很方便的。其实刚开始我也没有想到用人家开发好的插件调物理效果竟是我日常的工作之一,尤其是角色还有舞蹈的情况下,以为在静止状态下调好的效果可以适应所有环原创 2021-03-19 14:27:23 · 2886 阅读 · 6 评论 -
ARFoundation ARPlaneManager 动态查看变更信息
using System;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.XR.ARFoundation;public class ARPlaneInfo : MonoBehaviour{ public ARPlaneManager arPlaneManager; // Start is called before the first f.原创 2021-03-12 14:17:50 · 383 阅读 · 0 评论 -
ARFoundation 静态方法_检测是否支持人脸跟踪
public static bool IsFaceTrackingSupported() { var descriptors = new List<XRFaceSubsystemDescriptor>(); SubsystemManager.GetSubsystemDescriptors(descriptors); if (descriptors.Any()) { var descriptor = descriptors.First(); .原创 2021-02-20 16:51:48 · 306 阅读 · 0 评论 -
The type or namespace name ‘EditorWindow‘ could not be found
EditorWindow类无法打包出EXE 添加unity关键字定义如下文所示:#if UNITY_EDITORusing UnityEditor;public class TestEditor : EditorWindow{[MenuItem("Tools/TestMenu", false, 0)]static void TestMenu() { Debug.Log("TestMenu"); }}#endif...原创 2020-12-24 09:26:45 · 1346 阅读 · 0 评论 -
Unity 坐标转换之3D物体跟随鼠标移动
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class FollowMouse : MonoBehaviour { void Update() { if(Input.GetMouseButton(0)) { Vector3 tmp = Camera.ma.原创 2020-12-05 15:25:19 · 155 阅读 · 0 评论 -
NatCam 移动端插件 for Unity3d 使用设置
插件导入后需要将ios模块库更改为取消安卓平台编译,我是应用在安卓手机上故有此设置一步,发布ios平台的可以无视。插件样例介绍不是很多,但设置起来很方便,亲测不仅后置摄像头可以调整焦距,就连前置摄像头也可以调整,比系统自带的还厉害,真是 i 服了 u 了。曝光度调节 手电筒开关等等必需的设置都有了相对于手机端摄像头。具体设置如下:曝光调节NatCam.Camera.ExposureBias =value;焦距调节 NatCam.Camera.ZoomRatio = value ;手电筒.原创 2020-08-04 13:24:59 · 1208 阅读 · 0 评论 -
Unity3d 集成 Android 系统打印功能
研究了一段时间Android 系统打印功能,看到早在Android 4.0 也就是API Level>=19版本中就不需要再额外的安装打印驱动了,通过各种网站发现都是用同一种方法包括Android 开发官网也是使用PrintHelper 直接调用,当调用PrintHelper.printBitmap方法后,会出现用户选择界面(此处界面均为系统打印界面跟自己创建的无关),当然集成的只是打印功能的库,并无其它内容。经过查看PrintHelper类库,看到有个两个方法可以调用,一个是直接获取文件地址打.原创 2020-07-29 10:50:45 · 762 阅读 · 3 评论 -
Unity PlayClipAtPoint 背景音乐重复播放问题
using UnityEngine;public class PlayMusic: MonoBehaviour{ [SerializeField] private AudioClip _musicBG; private float _timer; void Start() { if (_musicBG!= null) { Au...原创 2018-03-21 09:09:11 · 1774 阅读 · 1 评论