- 博客(47)
- 资源 (13)
- 收藏
- 关注
原创 Unity代码切换XR Plug-in Management 内插件
如上图,做编辑器工具时需要代码切换到Cardboard XR plugin, 代码片段如下,拿去用不谢XRGeneralSettings androidXRSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildTargetGroup.Android); if (androidXRSettings == null) { ...
2022-02-23 13:31:36 5140 3
原创 Unity2020.1打包安卓报错sdk tools version 0.0 < 26.1.1
其中之一的解决方案。找到安卓adk目录下面的tools文件夹里package.xml文件,修改其中obsolete="true",替换为obsolete="false"然后 试试吧。行的话最好,不行的话再搜别的方法去吧。
2021-10-09 13:44:12 1172
原创 unity编辑器扩展-project窗口中获取选中的文件夹路径
效果图拿去直接用吧。代码如下public static string GetCurrentAssetDirectory() { foreach (var obj in Selection.GetFiltered<Object>(SelectionMode.Assets)) { var path = AssetDatabase.GetAssetPath(obj); if (string.IsNullO
2021-02-24 11:29:56 2932 1
原创 Unity中RectTransform类扩展 关于Anchor的代码操作
复制下来直接用吧using UnityEngine; public enum AnchorPresets { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottonCenter, BottomRight, BottomStretch, VertSt
2021-01-18 11:31:20 733
原创 Unity中 Camera 设置水平FOV
附加到camera直接用.如下图using System;using System.Globalization;using UnityEditor;using UnityEngine; // Lock the cameras horizontal field of view so it will frame the same view in the horizontal regardless of aspect ratio. [RequireComponent (typeof(Cam
2020-09-02 11:26:56 2242
原创 51单片机 对 char 反序列输出,以及注意事项
反序列输出 意思是 比如数值 0xaa (二进制 1010 1010),输出为 0x55(二进制 0101 0101).先上函数unsigned char Reverse(unsigned char _char){ unsigned char data aa = 0x00; unsigned char data bb = 0x00; unsigned char data cc = 0x00; unsigned char i; aa = _char; for (i = 0; i.
2020-06-08 11:36:12 571
原创 Unity内实现类似 UE4函数 MapRangeClamp
float MapRangeClamp(float value, float InFrom, float InEnd, float OutFrom, float OutEnd) { value = Mathf.Clamp(value, InFrom, InEnd); float InLength = Mathf.Abs(InEnd - InFro...
2019-06-16 02:58:39 882
原创 Unity判断顺时针或者逆时针旋转
Vector2 curPos; Vector2 lastPos; Vector2 centerInScreen; void Update() { curPos = eventData.position; centerInScreen = RectTransformUtility.WorldToScreenPoint(null...
2019-06-13 13:49:23 4514 1
原创 已知三点坐标。求组成三角形三个内角角度
void Calculate(Vector2 p1, Vector2 p2, Vector2 p3) { float a = Vector2.Distance(p2, p3); float b = Vector2.Distance(p1, p3); float c = Vector2.Distance(p1, p2); D...
2019-05-15 17:53:47 13892
原创 EpicInstaller-7.16.0-unrealengine.msi 安装失败,解决方法
安装到directX时候提示的才有可能用此法解决哦。found a way to fix DirectX so one can use the original EpicInstallerCtrl+R 输入 regedit 打开注册表找到路径 \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectX双击 Version改 "Value da...
2018-11-12 11:36:34 12094 1
原创 安卓命令行输出指定进程日志信息and bat命令结果赋值其他变量
@echo off for /F %%i in ('adb shell pidof com.packagename.youself') do ( set GetPid=%%i)echo 得到PID:%GetPid%adb shell logcat --pid %GetPid% -s Unity用法 :for循环那行pidof后面 包名 换成你自己的包名。...
2018-10-11 18:11:34 555
原创 Unity 输出Debug.log Debug.ErrorLog文件保存到本地
用法:直接挂到第一个场景内的游戏对象上即可。代码如下using System;using System.Collections;using System.Collections.Generic;using System.IO;using UnityEngine;public abstract class MonoSingletonManager<T> : MonoBe...
2018-08-20 16:16:06 4408 2
原创 adb install 显示进度
adb install 如果安装大文件。不知道进度很不人性化啊。所以写了个bat。bat代码如下.用法:如新建myadb.bat文件。命令行:myadb demo.apk@echo offset apkname=%1%::传入apk路径echo 您输入了参数:%apkname% Set filename=%apkname%set filename=%~nx1echo 文...
2018-07-24 15:50:09 6232
原创 unity安卓交互。多个插件共存
unity类AndroidJavaObject内提供静态调用 CallStatic 函数和非静态调用函数Call.。使用多个插件时候最方便的方法。如果你想调用安卓原生接口。而这个接口又不是静态的。你又使用了多个插件。那么你就需要这样做了。安卓类内定义一个静态实例。用静态实例再调用类内其他非静态函数。实例如下代码package com.example.libforunity;import andr...
2018-06-01 18:26:46 1397
原创 Unity中Threading和 协同程序 共同使用的简单方法
简单的使用方法using System.Collections;using System.IO;using System.Threading;using UnityEngine; public class TestScript : MonoBehaviour{ class Config { public string Version; public string Asset...
2018-05-25 12:37:01 905
原创 vuforia + zxing 解析二维码
拷贝下来 直接用。using UnityEngine;using System.Collections;using System;using Vuforia;using System.Threading;using ZXing;using ZXing.QrCode;using ZXing.Common;using UnityEngine.SceneManagement;publ
2016-05-07 10:55:55 2253 1
原创 unity3d中用2D背景当作图片
using UnityEngine;using System.Collections;public class Backdrop : MonoBehaviour{const string SHADER_CODE = "Shader \"UnlitAlpha\"{" +"Properties {" +"_Color (\"Color Tint (A = Opaci
2016-03-23 09:31:33 4264
原创 C# 写简单配置文件插件 SharpConfig 用法
using SharpConfig;Configuration config = Configuration.LoadFromFile(Application.streamingAssetsPath + "/sample.cfg"); Section section = config["General"]; string someString = sectio
2015-10-05 18:09:41 2947
原创 win8系统安装win7 sdk失败说明。
由于现在directShow没有和direcxtx一起发布,而是和windows sdk 打包发布了,可以到官网下载最新的windows sdk 开发包。各个版本区别GRMSDK_EN_DVD.iso x86GRMSDKIAI_EN_DVD.iso ItaniumGRMSDKX_EN_DVD.iso 64位的amd cpu如果你安装的是32位的windows 7,请
2015-06-16 17:27:34 1314
原创 NGUI 响应touchscript 的 tuio动作
using UnityEngine;using System.Collections;using TouchScript;using TouchScript.Layers;using TouchScript.Hit;using TouchScript.Utils;public class NGUICameraTouchLayer : TouchLayer{ private
2015-05-06 16:25:17 2584 2
原创 NGUI中texture序列帧图片播放
using UnityEngine;using System.Collections;public class FullTextureAnim : MonoBehaviour { public int mFPS = 30; public bool loop; public bool mActive = true; public bool isPlayback
2014-12-02 15:42:43 1352
转载 unity3d中类似googleearth的操作
脚本放到球体 就行了var numberAverages : int = 3;private var originalRotation : Quaternion;private var offsetRotation : Quaternion; // Make sure there are always SphereCollider and Rigidbody@script Require
2014-12-01 10:09:47 2328 1
原创 unity3D 用RenderTexture截图
private void MakeCameraImg(Camera mCam, int width, int height) { //Image mImage; RenderTexture rt = new RenderTexture(width, height, 0); mCam.pixelRect = new Rect(0, 0, Scr
2014-07-14 18:02:56 3077
原创 unity3d +KinectWrapperPackage手势识别
using UnityEngine;using System.Collections;public class HandsWave : MonoBehaviour { public GameObject leftHand; public GameObject rightHand; public GameObject rightElbow; public K
2014-06-25 10:11:02 3690
转载 多点触摸unity3d
using UnityEngine;using System.Collections;public class Move : MonoBehaviour { //用于绑定参照物对象 public Transform target; //缩放系数 float distance = 10.0f; //左右滑动移动速度 float xSpeed =
2014-03-24 17:45:26 965
转载 unity3D HOOK 键盘事件
using UnityEngine;using System.Collections;using System.Collections.Generic;using System;using System.Diagnostics;using System.Runtime.InteropServices;class InterceptKeys : MonoBehaviour{
2013-12-13 14:29:26 2547 1
转载 LineIntersection C#代码 求两点交点——2D
using System.Collections;public class LineIntersection{ public struct Point { public double x; public double y; }; public struct Line { public Point
2013-10-22 14:06:31 1540
转载 ease function 缓动函数 插值算法
各种类型 图标 http://easings.net/zh-cn官网 .http://www.robertpenner.com/easing/unity3D 所用C#代码easing.csusing UnityEngine;using System.Collections;using System;public static class Easing{ //
2013-07-12 20:15:52 3365
转载 C# sqlite
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.SQLite;namespace AirLibrary{ /**//// /// 数据库接口类 /// publ
2013-07-05 10:11:52 757
原创 unity3D 查看墙后面的对象 的 Shader
Shader "Pat/VisibleBehindObjects" {Properties { _MainTex ("Base (RGB) TransGloss (A)", 2D) = "white" {}}SubShader { CGPROGRAM#pragma surface surf BlinnPhong alphasampler2D _MainTex;
2013-06-08 15:58:27 1759
原创 MouseOrbit增加中轴缩放功能
var target : Transform;var distance = 10.0;var minidistance = 0.1;var maxidistance = 15.0;var xSpeed = 250.0;var ySpeed = 120.0;var yMinLimit = -20;var yMaxLimit = 80;private var x = 0.0;
2012-11-09 15:54:00 631
原创 unity3d 公告板(billboard)
using UnityEngine;using System.Collections;public class Billborad : MonoBehaviour { public Camera m_Camera; public Vector3 Normal;//面法线 Quaternion direction; // Use this for initi
2012-11-07 14:54:39 1823
转载 Unity3D官方资源完全下载
Unity3D官方资源完全下载1 - GUI Essentials.pdf2 - Scripting Tutorial.pdf2DGameplayTutorial.pdf2DGameplayTutorialProject.zip3DPlatformProject.zip3DPlatformTutorial.pdf
2012-11-06 14:25:08 5273 1
转载 unity3D 添加背景图片
// Copyright (c) 2010 Bob Berkebile// Please direct any bugs/comments/suggestions to http://www.pixelplacement.com//// Permission is hereby granted, free of charge, to any person obtaining a copy/
2012-08-24 16:48:53 4175
原创 OSG + GLSL 实现摇摆的树
#include #include #include #include #include #include #include #include #include #include #include #include #include #include
2011-09-21 09:47:26 2796 3
原创 OSG3.0 +cegui0.7.5 结合(支持中文显示)
cegui0.7.5 必须添加代码 setDefaultFont。设置 默认字体。 用0.6的 就没用就可以显示中文...浪费半天时间 惨啊。也可以改变scheme文件 。。也可以 用代码可以这样写: CEGUI::FontManager::getSingleton
2011-09-17 20:31:58 1870
OutputLogInCurrentDirctory.unitypackage
2020-09-15
Nexus Root Toolkit v2.1.9
2019-05-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人